base-4.10.0.0: Basic libraries

Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilitynon-portable (concurrency)
Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.QSem (signature[?])

Contents

Description

Simple quantity semaphores.

Synopsis

Simple Quantity Semaphores

data QSem Source #

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 :: Int -> IO QSem Source #

Build a new QSem with a supplied initial quantity. The initial quantity must be at least 0.

waitQSem :: QSem -> IO () Source #

Wait for a unit to become available

signalQSem :: QSem -> IO () Source #

Signal that a unit of the QSem is available