W3cubDocs

/Haskell 8

Control.Concurrent.QSem

Copyright (c) The University of Glasgow 2001
License BSD-style (see the file libraries/base/LICENSE)
Maintainer [email protected]
Stability experimental
Portability non-portable (concurrency)
Safe Haskell Safe
Language Haskell2010

Description

Simple quantity semaphores.

Simple Quantity Semaphores

data QSem Source

QSem is a quantity semaphore in which the resource is acquired 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

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.6.1/docs/html/libraries/base-4.12.0.0/Control-Concurrent-QSem.html