lifted-stm-0.2: STM operations lifted through monad transformer stacks

Safe HaskellSafe



Lifted TSem operations.



data TSem #

TSem is a transactional semaphore. It holds a certain number of units, and units may be acquired or released by waitTSem and signalTSem respectively. When the TSem is empty, waitTSem blocks.

Note that TSem has no concept of fairness, and there is no guarantee that threads blocked in waitTSem will be unblocked in the same order; in fact they will all be unblocked at the same time and will fight over the TSem. Hence TSem is not suitable if you expect there to be a high number of threads contending for the resource. However, like other STM abstractions, TSem is composable.

Since: stm-2.4.2

Eq TSem 
Instance details

Defined in Control.Concurrent.STM.TSem


(==) :: TSem -> TSem -> Bool #

(/=) :: TSem -> TSem -> Bool #

newTSem :: MonadBase STM μ => Integer -> μ TSem Source #

A lifted version of newTSem.

waitTSem :: MonadBase STM μ => TSem -> μ () Source #

A lifted version of waitTSem.

signalTSem :: MonadBase STM μ => TSem -> μ () Source #

A lifted version of signalTSem.

signalTSemN :: MonadBase STM μ => Natural -> TSem -> μ () Source #

A lifted version of signalTSemN.