Stability | experimental |
---|---|
Maintainer | Bas van Dijk <v.dijk.bas@gmail.com> |
Safe Haskell | Trustworthy |
This is a wrapped version of Control.Concurrent.MVar with types generalized
from IO
to all monads in either MonadBase
or MonadBaseControl
.
- data MVar a
- newEmptyMVar :: MonadBase IO m => m (MVar a)
- newMVar :: MonadBase IO m => a -> m (MVar a)
- takeMVar :: MonadBase IO m => MVar a -> m a
- putMVar :: MonadBase IO m => MVar a -> a -> m ()
- readMVar :: MonadBase IO m => MVar a -> m a
- swapMVar :: MonadBase IO m => MVar a -> a -> m a
- tryTakeMVar :: MonadBase IO m => MVar a -> m (Maybe a)
- tryPutMVar :: MonadBase IO m => MVar a -> a -> m Bool
- isEmptyMVar :: MonadBase IO m => MVar a -> m Bool
- withMVar :: MonadBaseControl IO m => MVar a -> (a -> m b) -> m b
- modifyMVar_ :: MonadBaseControl IO m => MVar a -> (a -> m a) -> m ()
- modifyMVar :: MonadBaseControl IO m => MVar a -> (a -> m (a, b)) -> m b
- modifyMVarMasked_ :: MonadBaseControl IO m => MVar a -> (a -> m a) -> m ()
- modifyMVarMasked :: MonadBaseControl IO m => MVar a -> (a -> m (a, b)) -> m b
- mkWeakMVar :: MonadBaseControl IO m => MVar a -> m () -> m (Weak (MVar a))
Documentation
data MVar a
An MVar
(pronounced "em-var") is a synchronising variable, used
for communication between concurrent threads. It can be thought of
as a a box, which may be empty or full.
newEmptyMVar :: MonadBase IO m => m (MVar a)Source
Generalized version of newEmptyMVar
.
tryTakeMVar :: MonadBase IO m => MVar a -> m (Maybe a)Source
Generalized version of tryTakeMVar
.
tryPutMVar :: MonadBase IO m => MVar a -> a -> m BoolSource
Generalized version of tryPutMVar
.
isEmptyMVar :: MonadBase IO m => MVar a -> m BoolSource
Generalized version of isEmptyMVar
.
withMVar :: MonadBaseControl IO m => MVar a -> (a -> m b) -> m bSource
Generalized version of withMVar
.
modifyMVar_ :: MonadBaseControl IO m => MVar a -> (a -> m a) -> m ()Source
Generalized version of modifyMVar_
.
modifyMVar :: MonadBaseControl IO m => MVar a -> (a -> m (a, b)) -> m bSource
Generalized version of modifyMVar
.
modifyMVarMasked_ :: MonadBaseControl IO m => MVar a -> (a -> m a) -> m ()Source
Generalized version of modifyMVarMasked_
.
modifyMVarMasked :: MonadBaseControl IO m => MVar a -> (a -> m (a, b)) -> m bSource
Generalized version of modifyMVarMasked
.
mkWeakMVar :: MonadBaseControl IO m => MVar a -> m () -> m (Weak (MVar a))Source
Generalized version of mkWeakMVar
.
Note any monadic side effects in m
of the "finalizer" computation are
discarded.