polysemy-conc-0.14.1.1: Polysemy effects for concurrency
Safe HaskellNone
LanguageGHC2021

Polysemy.Conc.Effect.Semaphore

Description

Semaphore effect, Internal.

Synopsis

Documentation

data Semaphore (a :: Type -> Type) b where Source #

This effect abstracts over the concept of a quantity semaphore, a concurrency primitive that contains a number of slots that can be acquired and released.

Constructors

Wait :: forall (a :: Type -> Type). Semaphore a ()

Wait until a slot is available, then acquire it.

Signal :: forall (a :: Type -> Type). Semaphore a ()

Release a slot.

wait :: forall (r :: EffectRow). Member Semaphore r => Sem r () Source #

Wait until a slot is available, then acquire it.

signal :: forall (r :: EffectRow). Member Semaphore r => Sem r () Source #

Release a slot.