Copyright | (c) Peter Robinson 2009 The University of Glasgow 2004 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Peter Robinson <robinson@ecs.tuwien.ac.at> |
Stability | experimental |
Portability | non-portable (requires STM) |
Safe Haskell | None |
Language | Haskell2010 |
Corresponds to Control.Concurrent.STM.TChan
Synopsis
- data TChan a
- newTChan :: MonadAdvSTM m => m (TChan a)
- newTChanIO :: IO (TChan a)
- readTChan :: MonadAdvSTM m => TChan a -> m a
- writeTChan :: MonadAdvSTM m => TChan a -> a -> m ()
- dupTChan :: MonadAdvSTM m => TChan a -> m (TChan a)
- unGetTChan :: MonadAdvSTM m => TChan a -> a -> m ()
- isEmptyTChan :: MonadAdvSTM m => TChan a -> m Bool
Documentation
newTChanIO :: IO (TChan a) Source #
IO
version of newTChan
. This is useful for creating top-level
TChan
s using unsafePerformIO
, because using
atomically
inside unsafePerformIO
isn't
possible.
writeTChan :: MonadAdvSTM m => TChan a -> a -> m () Source #
Write a value to a TChan
.
dupTChan :: MonadAdvSTM m => TChan a -> m (TChan a) Source #
Duplicate a TChan
: the duplicate channel begins empty, but data written to
either channel from then on will be available from both. Hence this creates
a kind of broadcast channel, where data written by anyone is seen by
everyone else.
unGetTChan :: MonadAdvSTM m => TChan a -> a -> m () Source #
Put a data item back onto a channel, where it will be the next item read.
isEmptyTChan :: MonadAdvSTM m => TChan a -> m Bool Source #