Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResizableSemaphore ¶
type ResizableSemaphore struct {
// contains filtered or unexported fields
}
func New ¶
func New(n int) *ResizableSemaphore
ResizeableSemaphore returns an initialized semaphore with n slots.
func (*ResizableSemaphore) Acquire ¶
func (r *ResizableSemaphore) Acquire(ctx context.Context) error
Acquire will attempt to acquire a slot. Will return an error if the context is canceled.
func (*ResizableSemaphore) Cap ¶
func (r *ResizableSemaphore) Cap() int
Cap returns the capacity of the semaphore (total slots available)
func (*ResizableSemaphore) Len ¶
func (r *ResizableSemaphore) Len() int
Len returns the length of the semaphore (the actively used slots)
func (*ResizableSemaphore) Release ¶
func (r *ResizableSemaphore) Release()
Release frees up a slot.
func (*ResizableSemaphore) Resize ¶
func (r *ResizableSemaphore) Resize(n int)
Resize resizes the underlying channel, increasing or reducing available slots.
func (*ResizableSemaphore) String ¶
func (r *ResizableSemaphore) String() string
Click to show internal directories.
Click to hide internal directories.