lock-free is simple fastest lock-free library based on cas written in golang.
Go (>=1.8)
go get github.com/hlts2/lock-free
wg := new(sync.WaitGroup)
lf := lockfree.New()
for i := 0; i < size; i++ {
wg.Add(1)
go func(i int) {
defer wg.Done()
// In the block between Wait and Signal, it becomes gruoute-safe
lf.Wait()
cnt++
lf.Signal()
}(i)
}
wg.Wait()
lock-free released under MIT license, refer LICENSE file.