polysemy-conc-0.12.0.0: Polysemy effects for concurrency
Safe HaskellSafe-Inferred
LanguageHaskell2010

Polysemy.Conc.Effect.Lock

Description

Lock effect, Internal

Synopsis

Documentation

data Lock :: Effect where Source #

An exclusive lock or mutex, protecting a region from concurrent access.

Constructors

Lock :: m a -> Lock m a

Run an action if the lock is available, block otherwise.

LockOr :: m a -> m a -> Lock m a

Run the second action if the lock is available, or the first action otherwise.

lock :: forall r a. Member Lock r => Sem r a -> Sem r a Source #

Run an action if the lock is available, block otherwise.

lockOr :: forall r a. Member Lock r => Sem r a -> Sem r a -> Sem r a Source #

Run an action if the lock is available, block otherwise.

lockOrSkip :: forall r a. Member Lock r => Sem r a -> Sem r (Maybe a) Source #

Run an action if the lock is available, skip and return Nothing otherwise.

lockOrSkip_ :: forall r a. Member Lock r => Sem r a -> Sem r () Source #

Run an action if the lock is available, skip otherwise. Return ().