Created
June 15, 2020 01:06
-
-
Save pacuna/0cb1776ca8642e6f785d268bd9799048 to your computer and use it in GitHub Desktop.
This file contains 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/coarselist" | |
"sync" | |
) | |
func main() { | |
l := coarselist.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: 200, 2nd run: 200, 3rd run: 200... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment