semaph

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 1 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()

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

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