Control.Concurrent.QSem.Lifted

lifted-base-0.2.3.6: lifted IO operations from the base library

Copyright | Liyang HU, Bas van Dijk
License | BSD-style
Maintainer | Bas van Dijk <v.dijk.bas@gmail.com>
Stability | experimental
Safe Haskell | Trustworthy
Language | Haskell98

Control.Concurrent.QSem.Lifted

Description

This is a wrapped version of Control.Concurrent.QSem with types generalised from `IO` to all monads in `MonadBase`.

Synopsis

- data QSem :: *
- newQSem :: MonadBase IO m => Int -> m QSem
- waitQSem :: MonadBase IO m => QSem -> m ()
- signalQSem :: MonadBase IO m => QSem -> m ()

# Documentation

data QSem :: *

`QSem` is a quantity semaphore in which the resource is aqcuired 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 :: MonadBase IO m => Int -> m QSem

Generalized version of `newQSem`.

waitQSem :: MonadBase IO m => QSem -> m ()

Generalized version of `waitQSem`.

signalQSem :: MonadBase IO m => QSem -> m ()

Generalized version of `signalQSem`.