Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sema ¶
type Sema chan struct{}
Sema provides a simple semaphore implementation
func (Sema) Acquire ¶
func (s Sema) Acquire()
Acquire will block if semaphore is full until any other holder release it.
func (Sema) AcquireWith ¶ added in v0.3.0
AcquireWith the given context, will block if semaphore is full until any other holder release or the context is canceled/expired.
func (Sema) AcquireWithin ¶
AcquireWithin the given timeout return true on success and false on failure
func (Sema) Release ¶
func (s Sema) Release()
Release the semaphore allowing wating waiters to acquire.
func (Sema) TryAcquire ¶
TryAcquire the semaphore without blocking return true on success and false on failure.
Click to show internal directories.
Click to hide internal directories.