semaphore

package
v0.0.0-...-444f1c3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 0 Imported by: 0

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
}

Semaphore is a very simple semaphore

func NewSemaphore

func NewSemaphore(permits int) *Semaphore

NewSemaphore creates a new semaphore with a given amount of permits before blocking.

func (*Semaphore) Acquire

func (s *Semaphore) Acquire()

Acquire acquires one of the permits of the semaphore, blocking if none available.

func (*Semaphore) Release

func (s *Semaphore) Release()

Release releases one of the semaphore's permits, making it available.

Jump to

Keyboard shortcuts

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