semaphore

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: GPL-3.0 Imports: 0 Imported by: 1

Documentation

Overview

Package semaphore implements a basic semaphore object widely inspired from source: http://www.golangpatterns.info/concurrency/semaphores

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Semaphore

type Semaphore chan empty

func New

func New(capacity uint64) Semaphore

New : new Semaphore object

func (Semaphore) Acquire

func (s Semaphore) Acquire()

Acquire : increment Semaphore by one

func (Semaphore) P

func (s Semaphore) P(n int)

P : acquire n resources

func (Semaphore) Release

func (s Semaphore) Release()

Release : decrement Semaphore by one

func (Semaphore) V

func (s Semaphore) V(n int)

V : release n resources

Jump to

Keyboard shortcuts

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