semaphore

package
v0.11.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 5 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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 semaphore

func (*Semaphore) Release

func (s *Semaphore) Release(n int64)

func (*Semaphore) Resize added in v0.0.92

func (s *Semaphore) Resize(ctx context.Context, newSize int64) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL