1
0
mirror of https://github.com/mayflower/docker-ls.git synced 2025-11-28 00:01:09 +03:00
Files
docker-ls/lib/connector/semaphore.go
2016-02-26 13:25:51 +01:00

20 lines
243 B
Go

package connector
type semaphore chan int
func (s semaphore) Lock() {
s <- 1
}
func (s semaphore) Unlock() {
_ = <-s
}
func newSemaphore(limit uint) semaphore {
if limit == 0 {
limit = 1
}
return semaphore(make(chan int, limit))
}