lifted-base-0.2.3.12: 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 Source #

`QSemN` is a quantity semaphore in which the resource is acquired and released in arbitrary amounts. 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 Source #

Generalized version of `newQSemN`.

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

Generalized version of `waitQSemN`.

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

Generalized version of `signalQSemN`.