lockfree

package module
v0.0.0-...-df59f3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2018 License: MIT Imports: 2 Imported by: 4

README

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockFree

type LockFree interface {
	Wait()
	Signal()
}

func New

func New() LockFree

New initializes a new instance of the LockFree

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL