Documentation ¶ Index ¶ type Semaphore func New(size int64) (*Semaphore, error) func (s *Semaphore) Acquire(ctx context.Context, n int64) error func (s *Semaphore) InitialSize() int64 func (s *Semaphore) Release(n int64) func (s *Semaphore) Size() int64 func (s *Semaphore) Vary(ctx context.Context, x int64) error Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Semaphore ¶ type Semaphore struct { // contains filtered or unexported fields } func New ¶ func New(size int64) (*Semaphore, error) func (*Semaphore) Acquire ¶ func (s *Semaphore) Acquire(ctx context.Context, n int64) error func (*Semaphore) InitialSize ¶ func (s *Semaphore) InitialSize() int64 Nominal size of the sempahore func (*Semaphore) Release ¶ func (s *Semaphore) Release(n int64) func (*Semaphore) Size ¶ func (s *Semaphore) Size() int64 Current size of the semaphore func (*Semaphore) Vary ¶ func (s *Semaphore) Vary(ctx context.Context, x int64) error Vary capacity by x - it's internally enqueued as a normal Acquire/Release operation as other Get/Put but tokens are held internally Source Files ¶ View all Source files semaphore.go Click to show internal directories. Click to hide internal directories.