Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hlts2/lock-free
Simple lock-free library written in golang
https://github.com/hlts2/lock-free
go golang golang-library goroutine goroutine-safe hlts2 library lock-free threadsafe
Last synced: about 1 month ago
JSON representation
Simple lock-free library written in golang
- Host: GitHub
- URL: https://github.com/hlts2/lock-free
- Owner: hlts2
- License: mit
- Created: 2018-07-18T12:11:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-28T11:20:45.000Z (over 6 years ago)
- Last Synced: 2024-10-13T14:15:11.330Z (3 months ago)
- Topics: go, golang, golang-library, goroutine, goroutine-safe, hlts2, library, lock-free, threadsafe
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lock-free
lock-free is simple fastest lock-free library based on [cas](https://en.wikipedia.org/wiki/Compare-and-swap) written in golang.## Requirement
Go (>=1.8)
## Installation
```shell
go get github.com/hlts2/lock-free
```## Example
```go
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](https://github.com/hlts2)## LICENSE
lock-free released under MIT license, refer [LICENSE](https://github.com/hlts2/lock-free/blob/master/LICENSE) file.