sem

package
v0.0.0-...-d4978fa Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2019 License: Unlicense Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type T

type T chan semaphore

func New

func New(limit int) T

New creates a new semaphore of a given capacity.

func (T) Acquire

func (t T) Acquire()

Acquire causes threads waiting on release to stop working. Note that because the channel is buffered, this can execute as many times as number of buffers, thus blocking subsequent callers until one of the buffers is released

func (T) Release

func (t T) Release() T

Release can be waited on or selected to get a stop work signal. This essentially empties a slot in the semaphore which allows another thread to acquire it

Jump to

Keyboard shortcuts

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