Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Concurrency useful and common functions.
Synopsis
- data MVar a
- newEmptyMVar :: MonadIO m => m (MVar a)
- newMVar :: MonadIO m => a -> m (MVar a)
- putMVar :: MonadIO m => MVar a -> a -> m ()
- readMVar :: MonadIO m => MVar a -> m a
- swapMVar :: MonadIO m => MVar a -> a -> m a
- takeMVar :: MonadIO m => MVar a -> m a
- tryPutMVar :: MonadIO m => MVar a -> a -> m Bool
- tryReadMVar :: MonadIO m => MVar a -> m (Maybe a)
- tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a)
- data STM a
- data TVar a
- atomically :: MonadIO m => STM a -> m a
- newTVarIO :: MonadIO m => a -> m (TVar a)
- readTVarIO :: MonadIO m => TVar a -> m a
- modifyTVar' :: TVar a -> (a -> a) -> STM ()
- newTVar :: a -> STM (TVar a)
- readTVar :: TVar a -> STM a
- writeTVar :: TVar a -> a -> STM ()
MVar
An MVar
(pronounced "em-var") is a synchronising variable, used
for communication between concurrent threads. It can be thought of
as a box, which may be empty or full.
Instances
NFData1 MVar | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Eq (MVar a) | Since: base-4.1.0.0 |
NFData (MVar a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq |
newEmptyMVar :: MonadIO m => m (MVar a) Source #
Lifted to MonadIO
version of newEmptyMVar
.
tryPutMVar :: MonadIO m => MVar a -> a -> m Bool Source #
Lifted to MonadIO
version of tryPutMVar
.
tryReadMVar :: MonadIO m => MVar a -> m (Maybe a) Source #
Lifted to MonadIO
version of tryReadMVar
.
tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a) Source #
Lifted to MonadIO
version of tryTakeMVar
.
STM
A monad supporting atomic memory transactions.
Instances
Monad STM | Since: base-4.3.0.0 |
Functor STM | Since: base-4.3.0.0 |
Applicative STM | Since: base-4.8.0.0 |
Alternative STM | Since: base-4.8.0.0 |
MonadPlus STM | Since: base-4.3.0.0 |
MonadThrow STM | |
Defined in Control.Monad.Catch | |
MonadCatch STM | |
Shared memory locations that support atomic memory transactions.
atomically :: MonadIO m => STM a -> m a Source #
Lifted to MonadIO
version of atomically
.
readTVarIO :: MonadIO m => TVar a -> m a Source #
Lifted to MonadIO
version of readTVarIO
.
modifyTVar' :: TVar a -> (a -> a) -> STM () #
Strict version of modifyTVar
.
Since: stm-2.3