semaphore

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 5 Imported by: 2

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 sempahore

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