lifted-base-0.2.3.11: 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 | Safe
Language | Haskell98

Control.Concurrent.QSemN.Lifted

Description

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

Synopsis

- data QSemN :: *
- newQSemN :: MonadBase IO m => Int -> m QSemN
- waitQSemN :: MonadBase IO m => QSemN -> Int -> m ()
- signalQSemN :: MonadBase IO m => QSemN -> Int -> m ()

# Documentation

data QSemN :: * #

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

Generalized version of `newQSemN`.

waitQSemN :: MonadBase IO m => QSemN -> Int -> m () #

Generalized version of `waitQSemN`.

signalQSemN :: MonadBase IO m => QSemN -> Int -> m () #

Generalized version of `signalQSemN`.