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

UnliftIO.QSemN

Description

Unlifted Control.Concurrent.QSemN .

Since: 0.2.14

Synopsis

Documentation

data QSemN Source #

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.

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

Lifted waitQSemN .

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