Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/f2prateek/semaphore
https://github.com/f2prateek/semaphore
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/f2prateek/semaphore
- Owner: f2prateek
- Created: 2015-09-22T22:12:33.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-01T16:41:46.000Z (over 8 years ago)
- Last Synced: 2023-07-27T22:06:08.112Z (over 1 year ago)
- Language: Go
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# semaphore
Provides a semaphore synchronization primitive. A semaphore controls access to a finite number of resources.
# Usage
```go
s := semaphore.New(5)for {
s.Acquire()
// Only 5 go-routines will run simultaneously.
go func() {
defer s.Release()
}()
}
```