sem

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTickets      = errors.New("semaphore: could not aquire semaphore")
	ErrIllegalRelease = errors.New("semaphore: can't release the semaphore without acquiring it first")
)

Functions

This section is empty.

Types

type SemInterface

type SemInterface interface {
	Acquire() error
	Release() error
}

SemInterface contains the behavior of a semaphore that can be acquired and/or released. Other types implement methods in the interface to implement a mutex

func New

func New(tickets int, timeout time.Duration) SemInterface

New create semaphonre mutex lock with timeout,tickets: a limited number of resources

Jump to

Keyboard shortcuts

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