unliftio-0.2.20.1: The MonadUnliftIO typeclass for unlifting monads to IO (batteries included)
Safe HaskellNone
LanguageHaskell2010

UnliftIO.QSem

Description

Unlifted Control.Concurrent.QSem.

Since: 0.2.14

Synopsis

Documentation

data QSem #

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

The pattern

  bracket_ waitQSem signalQSem (...)

is safe; it never loses a unit of the resource.

newQSem :: MonadIO m => Int -> m QSem Source #

Lifted newQSem.

Since: 0.2.14

waitQSem :: MonadIO m => QSem -> m () Source #

Lifted waitQSem.

Since: 0.2.14

signalQSem :: MonadIO m => QSem -> m () Source #

Lifted signalQSem.

Since: 0.2.14

withQSem :: MonadUnliftIO m => QSem -> m a -> m a Source #

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

Since: 0.2.14