stm-promise-0.0.2: Simple STM Promises for IO computations and external processes

Safe HaskellNone



TVars with a dirty bit that allows for one listener



data DTVar a Source

TVars with a dirty bit which allows for one listener.

newDTVar :: a -> STM (DTVar a)Source

New DTVar which starts dirty

writeDTVar :: DTVar a -> a -> STM ()Source

Write a value to a DTVar, making it dirty

readDTVar :: DTVar a -> STM aSource

Reads a DTVar without changing the dirty bit

listenDTVar :: DTVar a -> STM aSource

Listens until the dirty bit is true, then removes the dirty bit and returns the read element

listenDTVars :: [DTVar a] -> STM [a]Source

Listen until any of the dirty bits are true, then removes all dirty bits and returns all DTVar's values, in order.

modifyDTVar :: DTVar a -> (a -> a) -> STM ()Source

Modify a DTVar, making it dirty.