GHC.Driver.MakeSem

ghc-9.10.0.20240413: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Driver.MakeSem

Contents

- JSem: parallelism semaphore backed
- System semaphores
- Abstract semaphores

Description

Implementation of a jobserver using system semaphores.

Synopsis

- runJSemAbstractSem :: SemaphoreName -> (AbstractSem -> IO a) -> IO a
- data Semaphore
- newtype SemaphoreName = SemaphoreName {
  - getSemaphoreName :: String
  }
- data AbstractSem = AbstractSem {
  - acquireSem :: IO ()
  - releaseSem :: IO ()
  }
- withAbstractSem :: AbstractSem -> IO b -> IO b

# JSem: parallelism semaphore backed

runJSemAbstractSem Source #

Arguments

:: SemaphoreName | the system semaphore to use
-> (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.

# System semaphores

data Semaphore Source #

A system semaphore (POSIX or Win32).

newtype SemaphoreName Source #

Constructors

SemaphoreName |
Fields getSemaphoreName :: String

#### Instances

Instances details

Eq SemaphoreName |
Instance details Defined in System.Semaphore Methods (==) :: SemaphoreName -> SemaphoreName -> Bool # (/=) :: SemaphoreName -> SemaphoreName -> Bool #

# Abstract semaphores

data AbstractSem Source #

Abstraction over the operations of a semaphore.

Constructors

AbstractSem |
Fields acquireSem :: IO () releaseSem :: IO ()

withAbstractSem :: AbstractSem -> IO b -> IO b Source #