semaphore

package
v2.0.0-...-a21236f Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package semaphore implements a basic semaphore for coordinating and limiting non-exclusive, concurrent access.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Semaphore

type Semaphore chan struct{}

func New

func New(concurrency int) Semaphore

New creates a semaphore with the given concurrency limit.

func (Semaphore) Acquire

func (s Semaphore) Acquire()

Acquire will block until the semaphore can be acquired.

func (Semaphore) Release

func (s Semaphore) Release()

Release frees the acquired slot in the semaphore.

Jump to

Keyboard shortcuts

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