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.
Modulestm-2.5.3.1Haskell2010
Control.Concurrent.STM.TMVar
Contents
Synopsis
- newtype TMVar
- value newTMVar
- value newEmptyTMVar
- value newTMVarIO
- value newEmptyTMVarIO
- value takeTMVar
- value putTMVar
- value readTMVar
- value writeTMVar
- value tryReadTMVar
- value swapTMVar
- value tryTakeTMVar
- value tryPutTMVar
- value isEmptyTMVar
- value mkWeakTMVar
- Packagestm-2.5.3.1
- Exports15
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceTMVar.hs
TMVars
Create a TMVar which contains the supplied value.
Create a TMVar which is initially empty.
IO version of newTMVar. This is useful for creating top-level
TMVars using unsafePerformIO, because using
atomically inside unsafePerformIO isn't
possible.
IO version of newEmptyTMVar. This is useful for creating top-level
TMVars using unsafePerformIO, because using
atomically inside unsafePerformIO isn't
possible.
Non-blocking write of a new value to a TMVar Puts if empty. Replaces if populated.
A version of readTMVar which does not retry. Instead it
returns Nothing if no value is available.
Swap the contents of a TMVar for a new value.
A version of takeTMVar that does not retry. The tryTakeTMVar
function returns Nothing if the TMVar was empty, or Just a if
the TMVar was full with contents a. After tryTakeTMVar, the
TMVar is left empty.
Check whether a given TMVar is empty.