Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Semaphore ¶
type Semaphore chan struct{}
Semaphore is a wrapper around a channel to provide utility methods to clarify that we are treating the channel as a semaphore
func New ¶
NewSemaphore creates a semaphore that allows up to a given limit of simultaneous acquisitions
func (Semaphore) Acquire ¶
func (s Semaphore) Acquire()
Acquire is used to acquire an available slot. Blocks until available.
func (Semaphore) Release ¶
func (s Semaphore) Release()
Release is used to return a slot. Acquire must be called as a pre-condition.
func (Semaphore) TryAcquire ¶
TryAcquire is used to do a non-blocking acquire. Returns a bool indicating success
Click to show internal directories.
Click to hide internal directories.