ghc-9.12.4.20260713: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Driver.MakeSem

Description

Implementation of a jobserver using system semaphores.

Synopsis

JSem: parallelism semaphore backed

runJSemAbstractSem Source #

Arguments

:: SemaphoreIdentifier

the semaphore identifier (from -jsem)

-> (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.