Skip to content
abiosoftPublic

About

Wrapping sync.Mutex for familiar semaphore api

Topics

Resources

Stars

45 stars

Watchers

2 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

semaphore

Semaphore in Go

Build Status GoDoc Go Report Card

Usage

Initiate

import "github.com/abiosoft/semaphore"
...
sem := semaphore.New(5) // new semaphore with 5 permits

Acquire

sem.Acquire() // one
sem.AcquireMany(n) // multiple
sem.AcquireWithin(n, time.Second * 5) // timeout after 5 sec
sem.AcquireContext(ctx, n) // acquire with context

Release

sem.Release() // one
sem.ReleaseMany(n) // multiple

documentation

http://godoc.org/github.com/abiosoft/semaphore

About

Wrapping sync.Mutex for familiar semaphore api

Topics

Resources

Stars

45 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages