Copyright | (c) 2016 Michael Walker |
---|---|
License | MIT |
Maintainer | Michael Walker <mike@barrucadu.co.uk> |
Stability | stable |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Transactional MVar
s, for use with MonadSTM
.
Deviations: TMVar
as defined here does not have an Eq
instance, this is because the MonadSTM
TVar
type does not have
an Eq
constraint. Furthermore, the newTMVarIO
,
newEmptyTMVarIO
, and mkWeakTMVar
functions are not provided.
- data TMVar stm a
- newTMVar :: MonadSTM stm => a -> stm (TMVar stm a)
- newTMVarN :: MonadSTM stm => String -> a -> stm (TMVar stm a)
- newEmptyTMVar :: MonadSTM stm => stm (TMVar stm a)
- newEmptyTMVarN :: MonadSTM stm => String -> stm (TMVar stm a)
- takeTMVar :: MonadSTM stm => TMVar stm a -> stm a
- putTMVar :: MonadSTM stm => TMVar stm a -> a -> stm ()
- readTMVar :: MonadSTM stm => TMVar stm a -> stm a
- tryTakeTMVar :: MonadSTM stm => TMVar stm a -> stm (Maybe a)
- tryPutTMVar :: MonadSTM stm => TMVar stm a -> a -> stm Bool
- tryReadTMVar :: MonadSTM stm => TMVar stm a -> stm (Maybe a)
- isEmptyTMVar :: MonadSTM stm => TMVar stm a -> stm Bool
- swapTMVar :: MonadSTM stm => TMVar stm a -> a -> stm a
TMVar
s
A TMVar
is like an MVar
or a mVar
, but using transactional
memory. As transactions are atomic, this makes dealing with
multiple TMVar
s easier than wrangling multiple mVar
s.
Since: 1.0.0.0
newTMVar :: MonadSTM stm => a -> stm (TMVar stm a) Source #
Create a TMVar
containing the given value.
Since: 1.0.0.0