unliftio-0.2.23.0: The MonadUnliftIO typeclass for unlifting monads to IO (batteries included)
Safe Haskell None
Language Haskell2010

UnliftIO.QSem

Description

Unlifted Control.Concurrent.QSem .

Since: 0.2.14

Synopsis

Documentation

data QSem Source #

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.

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