Versions in this module Expand all Collapse all v1 v1.1.0 Apr 13, 2026 Changes in this version + type ErrAcquireCancelled struct + Cause error + func (e ErrAcquireCancelled) Error() string + func (e ErrAcquireCancelled) Is(target error) bool + func (e ErrAcquireCancelled) String() string + func (e ErrAcquireCancelled) Unwrap() error + type ErrDrain struct + Cause string + func (e ErrDrain) Error() string + func (e ErrDrain) Is(target error) bool + func (e ErrDrain) String() string + type ErrInvalidCap struct + Value int + func (e ErrInvalidCap) Error() string + func (e ErrInvalidCap) Is(target error) bool + func (e ErrInvalidCap) String() string + type ErrInvalidN struct + Value int + func (e ErrInvalidN) Error() string + func (e ErrInvalidN) Is(target error) bool + func (e ErrInvalidN) String() string + type ErrNExceedsCap struct + Cap int + Requested int + func (e ErrNExceedsCap) Error() string + func (e ErrNExceedsCap) Is(target error) bool + func (e ErrNExceedsCap) String() string + type ErrNoSlot struct + Available int + Requested int + func (e ErrNoSlot) Error() string + func (e ErrNoSlot) Is(target error) bool + func (e ErrNoSlot) String() string + type ErrRecovered struct + AsError error + Cause any + func (e ErrRecovered) Error() string + func (e ErrRecovered) Is(target error) bool + func (e ErrRecovered) String() string + func (e ErrRecovered) Unwrap() error + type ErrReleaseExceedsCount struct + Attempted int + Current int + func (e ErrReleaseExceedsCount) Error() string + func (e ErrReleaseExceedsCount) Is(target error) bool + func (e ErrReleaseExceedsCount) String() string + type Observer interface + OnAcquire func(count, cap int) + OnRelease func(count, cap int) + OnWaitEnd func(err error) + OnWaitStart func() type Semaphore + func Must(c int) Semaphore + func NewWithObserver(c int, obs Observer) (Semaphore, error) + AcquireN func(n int) error + AcquireNTimeout func(n int, d time.Duration) error + AcquireNWith func(ctx context.Context, n int) error + AcquireTimeout func(d time.Duration) error + AcquireWith func(ctx context.Context) error + Cap func() int + Drain func() error + IsFull func() bool + ReleaseN func(n int) error + Reset func() error + SetCap func(c int) error + TryAcquire func() bool + TryAcquireN func(n int) bool + TryAcquireNWith func(ctx context.Context, n int) error + TryAcquireWith func(ctx context.Context) error + Utilization func() float64 + UtilizationSmoothed func() float64 + Wait func(ctx context.Context) error v1.0.0 Mar 23, 2025 Changes in this version + type Semaphore interface + Acquire func() + IsEmpty func() bool + Len func() int + Release func() + func New(maxConcurrency int) Semaphore