Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data TMVar a
- newTMVar :: a -> STM (TMVar a)
- newTMVarIO :: MonadIO m => a -> m (TMVar a)
- newEmptyTMVar :: STM (TMVar a)
- newEmptyTMVarIO :: MonadIO m => m (TMVar a)
- takeTMVar :: TMVar a -> STM a
- tryTakeTMVar :: TMVar a -> STM (Maybe a)
- putTMVar :: TMVar a -> a -> STM ()
- tryPutTMVar :: TMVar a -> a -> STM Bool
- readTMVar :: TMVar a -> STM a
- tryReadTMVar :: TMVar a -> STM (Maybe a)
- swapTMVar :: TMVar a -> a -> STM a
- isEmptyTMVar :: TMVar a -> STM Bool
- mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a))
TMVar
A TMVar
is a synchronising variable, used
for communication between concurrent threads. It can be thought of
as a box, which may be empty or full.
newTMVarIO :: MonadIO m => a -> m (TMVar a) #
Lifted version of newTMVarIO
Since: unliftio-0.2.1.0
newEmptyTMVar :: STM (TMVar a) #
Create a TMVar
which is initially empty.
newEmptyTMVarIO :: MonadIO m => m (TMVar a) #
Lifted version of newEmptyTMVarIO
Since: unliftio-0.2.1.0
tryTakeTMVar :: TMVar a -> STM (Maybe a) #
A version of takeTMVar
that does not retry
. The tryTakeTMVar
function returns Nothing
if the TMVar
was empty, or
if
the Just
aTMVar
was full with contents a
. After tryTakeTMVar
, the
TMVar
is left empty.
tryPutTMVar :: TMVar a -> a -> STM Bool #
tryReadTMVar :: TMVar a -> STM (Maybe a) #
A version of readTMVar
which does not retry. Instead it
returns Nothing
if no value is available.
Since: stm-2.3
mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a)) #
Lifted version of mkWeakTMVar
Since: unliftio-0.2.1.0