unliftio-0.2.25.0: The MonadUnliftIO typeclass for unlifting monads to IO (batteries included)
Safe HaskellSafe-Inferred
LanguageHaskell2010

UnliftIO.QSemN

Description

Unlifted Control.Concurrent.QSemN.

Since: 0.2.14

Synopsis

Documentation

data QSemN #

QSemN is a quantity semaphore in which the resource is acquired and released in units of one. It provides guaranteed FIFO ordering for satisfying blocked waitQSemN calls.

The pattern

  bracket_ (waitQSemN n) (signalQSemN n) (...)

is safe; it never loses any of the resource.

newQSemN :: MonadIO m => Int -> m QSemN Source #

Lifted newQSemN.

Since: 0.2.14

waitQSemN :: MonadIO m => QSemN -> Int -> m () Source #

Lifted waitQSemN.

Since: 0.2.14

signalQSemN :: MonadIO m => QSemN -> Int -> m () Source #

Lifted signalQSemN.

Since: 0.2.14

withQSemN :: MonadUnliftIO m => QSemN -> Int -> m a -> m a Source #

withQSemN is an exception-safe wrapper for performing the provided operation while holding N unit of value from the semaphore. It ensures the semaphore cannot be leaked if there are exceptions.

Since: 0.2.14