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