| Portability | non-portable (requires STM) |
|---|---|
| Stability | experimental |
| Maintainer | libraries@haskell.org |
Control.Concurrent.STM.TChan
Contents
Description
TChan: Transactional channels (GHC only)
TChans
newTChanIO :: IO (TChan a)
IO version of newTChan. This is useful for creating top-level
TChans using System.IO.Unsafe.unsafePerformIO, because using
atomically inside System.IO.Unsafe.unsafePerformIO isn't
possible.
writeTChan :: TChan a -> a -> STM ()
Write a value to a TChan.
dupTChan :: TChan a -> STM (TChan a)
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 :: TChan a -> a -> STM ()
Put a data item back onto a channel, where it will be the next item read.