Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 716 Bytes

README.md

File metadata and controls

43 lines (28 loc) · 716 Bytes

lock-free

lock-free is simple fastest lock-free library based on cas written in golang.

Requirement

Go (>=1.8)

Installation

go get github.com/hlts2/lock-free

Example

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()

Author

hlts2

LICENSE

lock-free released under MIT license, refer LICENSE file.