Safe Haskell | Safe-Inferred |
---|
Data.Queue.Instances
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.
data STM a
A monad supporting atomic memory transactions.
Instances
Monad STM | |
Functor STM | |
Typeable1 STM | |
MonadFix STM | |
MonadPlus STM | |
Monad STM => NewFifo (TMVar a) STM | |
Monad STM => NewFifo (TChan a) STM | |
Monad STM => PeekQueue (TChan a) STM a | |
Monad STM => Dequeue (TMVar a) STM a | |
Monad STM => Dequeue (TChan a) STM a | |
Monad STM => Enqueue (TMVar a) STM a | |
Monad STM => Enqueue (TChan a) STM a | |
Monad STM => DefaultFifo (TChan a) STM a |
data TChan a
TChan
is an abstract type representing an unbounded FIFO channel.
Instances
Typeable1 TChan | |
Eq (TChan a) | |
Monad IO => NewFifo (TChan a) IO | |
Monad STM => NewFifo (TChan a) STM | |
Monad IO => PeekQueue (TChan a) IO a | |
Monad STM => PeekQueue (TChan a) STM a | |
Monad IO => Dequeue (TChan a) IO a | |
Monad STM => Dequeue (TChan a) STM a | |
Monad IO => Enqueue (TChan a) IO a | |
Monad STM => Enqueue (TChan a) STM a | |
Monad IO => DefaultFifo (TChan a) IO a | |
Monad STM => DefaultFifo (TChan a) STM a |
data TMVar a
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.
atomically :: STM a -> IO a
Perform a series of STM actions atomically.
You cannot use atomically
inside an unsafePerformIO
or unsafeInterleaveIO
.
Any attempt to do so will result in a runtime error. (Reason: allowing
this would effectively allow a transaction inside a transaction, depending
on exactly when the thunk is evaluated.)
However, see newTVarIO
, which can be called inside unsafePerformIO
,
and which allows top-level TVars to be allocated.