semaph

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Semaph

type Semaph struct {
	// contains filtered or unexported fields
}

func NewSemaph

func NewSemaph(max int32) *Semaph

func (*Semaph) Acquire

func (s *Semaph) Acquire(ctx context.Context) error

Acquire will block if there are no more "tickets" left; otherwise will decrement number of tickets and continue. Caller must call Release() later.

func (*Semaph) R added in v0.8.0

func (s *Semaph) R() int32

func (*Semaph) Release

func (s *Semaph) Release()

Release will free up a "ticket", and if there were any waiting goroutines, will Signal() (one of) them.

Jump to

Keyboard shortcuts

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