dejafu-0.1.0.0: Overloadable primitives for testable, potentially non-deterministic, concurrency.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Concurrent.STM.CTVar

Contents

Description

Transactional variables, for use with MonadSTM.

Synopsis

CTVars

newCTVar :: MonadSTM m => a -> m (CTVar m a) Source

Create a new CTVar containing the given value.

readCTVar :: MonadSTM m => CTVar m a -> m a Source

Return the current value stored in a CTVar.

writeCTVar :: MonadSTM m => CTVar m a -> a -> m () Source

Write the supplied value into the CTVar.

modifyCTVar :: MonadSTM m => CTVar m a -> (a -> a) -> m () Source

Mutate the contents of a CTVar. This is non-strict.

modifyCTVar' :: MonadSTM m => CTVar m a -> (a -> a) -> m () Source

Mutate the contents of a CTVar strictly.

swapCTVar :: MonadSTM m => CTVar m a -> a -> m a Source

Swap the contents of a CTVar, returning the old value.