stm-lifted-2.5.0.0: Software Transactional Memory lifted to MonadIO

Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.STM.TVar.Lifted

Synopsis

Documentation

registerDelay :: Int -> IO (TVar Bool) #

Switch the value of returned TVar from initial value False to True after a given number of microseconds. The caveats associated with threadDelay also apply.

writeTVar :: TVar a -> a -> STM () #

Write the supplied value into a TVar.

readTVar :: TVar a -> STM a #

Return the current value stored in a TVar.

newTVar :: a -> STM (TVar a) #

Create a new TVar holding a value supplied

data TVar a #

Shared memory locations that support atomic memory transactions.

Instances
Eq (TVar a)

Since: base-4.8.0.0

Instance details

Defined in GHC.Conc.Sync

Methods

(==) :: TVar a -> TVar a -> Bool #

(/=) :: TVar a -> TVar a -> Bool #

mkWeakTVar :: TVar a -> IO () -> IO (Weak (TVar a)) #

Make a Weak pointer to a TVar, using the second argument as a finalizer to run when TVar is garbage-collected

Since: stm-2.4.3

swapTVar :: TVar a -> a -> STM a #

Swap the contents of a TVar for a new value.

Since: stm-2.3

stateTVar :: TVar s -> (s -> (a, s)) -> STM a #

Like modifyTVar' but the function is a simple state transition that can return a side value which is passed on as the result of the STM.

Since: stm-2.5.0

modifyTVar' :: TVar a -> (a -> a) -> STM () #

Strict version of modifyTVar.

Since: stm-2.3

modifyTVar :: TVar a -> (a -> a) -> STM () #

Mutate the contents of a TVar. N.B., this version is non-strict.

Since: stm-2.3

newTVarIO :: MonadIO m => a -> m (TVar a) Source #

readTVarIO :: MonadIO m => TVar a -> m a Source #

writeTVarIO :: MonadIO m => TVar a -> a -> m () Source #

modifyTVarIO :: MonadIO m => TVar a -> (a -> a) -> m () Source #

Non-strict version

modifyTVarIO' :: MonadIO m => TVar a -> (a -> a) -> m () Source #

Strict version

stateTVarIO :: MonadIO m => TVar s -> (s -> (a, s)) -> m a Source #

swapTVarIO :: MonadIO m => TVar a -> a -> m a Source #