Created
June 15, 2020 00:58
-
-
Save pacuna/e26ff304fb1657172f3a157e412e1c65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sortedlist/simplelist" | |
"sync" | |
) | |
func main() { | |
l := simplelist.New() | |
var wg sync.WaitGroup | |
for i := 0; i < 200; i++ { | |
wg.Add(1) | |
go func(it int) { | |
item := []byte(string(it)) | |
l.Add(item) | |
wg.Done() | |
}(i) | |
} | |
wg.Wait() | |
fmt.Println(l.Size()) // 1st run: 199, 2nd run: 198, 3rd run: 200... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment