Skip to content

Instantly share code, notes, and snippets.

@pacuna
Created June 15, 2020 01:06
Show Gist options
  • Save pacuna/0cb1776ca8642e6f785d268bd9799048 to your computer and use it in GitHub Desktop.
Save pacuna/0cb1776ca8642e6f785d268bd9799048 to your computer and use it in GitHub Desktop.
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