semaphore

package
v0.0.0-...-69312e8 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2018 License: MIT Imports: 1 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 {
	Threads chan int
	Wg      sync.WaitGroup
}

Semaphore implements the signal mechanism management

func NewSemaphore

func NewSemaphore(n int) *Semaphore

NewSemaphore returns a new semaphore

func (*Semaphore) P

func (sem *Semaphore) P()

P is a primitive operation that requests the allocation of a unit resource

func (*Semaphore) V

func (sem *Semaphore) V()

V is a primitive operation that releases a unit of resources

func (*Semaphore) Wait

func (sem *Semaphore) Wait()

Wait waits for all unit resources to be released

Jump to

Keyboard shortcuts

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