semaphore

package
v0.0.0-...-e51ace1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Acquire

func Acquire(ctx context.Context, n int) error

Acquire enters the semaphore a specified number of times, blocking only until ctx is done.

func GetCount

func GetCount() int

GetCount returns current number of occupied entries in semaphore.

func GetLimit

func GetLimit() int

GetLimit returns current semaphore limit.

func New

func New(limit int) sem.Semaphore

New initializes a new instance of the Semaphore, specifying the maximum number of concurrent entries.

func Release

func Release(n int) int

Release exits the semaphore a specified number of times and returns the previous count.

func SetParallel

func SetParallel(i int) error

SetParallel sets a given number to the parallelism number.

func TryAcquire

func TryAcquire(n int) bool

TryAcquire acquires the semaphore without blocking.

Types

type Semaphore

type Semaphore = sem.Semaphore

Semaphore counting resizable semaphore synchronization primitive.

Jump to

Keyboard shortcuts

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