Skip to content

Instantly share code, notes, and snippets.

@pacuna

pacuna/lZ8fA2ci.go

Created Jun 15, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.