| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
GHC.Driver.MakeSem
Description
Implementation of a jobserver using system semaphores.
Synopsis
- runJSemAbstractSem :: SemaphoreIdentifier -> (AbstractSem -> IO a) -> IO a
- data AbstractSem = AbstractSem {
- acquireSem :: IO ()
- releaseSem :: IO ()
- withAbstractSem :: AbstractSem -> IO b -> IO b
JSem: parallelism semaphore backed
Arguments
| :: SemaphoreIdentifier | the semaphore identifier (from |
| -> (AbstractSem -> IO a) | the operation to run which requires a semaphore |
| -> IO a |
Implement an abstract semaphore using a semaphore Jobserver
which queries the system semaphore of the given name for resources.
Abstract semaphores
data AbstractSem Source #
Abstraction over the operations of a semaphore.
Constructors
| AbstractSem | |
Fields
| |
withAbstractSem :: AbstractSem -> IO b -> IO b Source #
Acquire/release bracket pattern: acquire a token, perform an action, and release the token.
Guarantees that the token is released in case that the inner action throws an exception.