| Haskell Hierarchical Libraries (stm package) | Source code | Contents | Index
Control.Concurrent.STM.TChan |
Portability | non-portable (requires STM)
Stability | experimental
Maintainer | libraries@haskell.org
Contents
TChans
Description
TChan: Transactional channels
Synopsis
data TChan a
newTChan :: STM (TChan a)
newTChanIO :: IO (TChan a)
readTChan :: TChan a -> STM a
writeTChan :: TChan a -> a -> STM ()
dupTChan :: TChan a -> STM (TChan a)
unGetTChan :: TChan a -> a -> STM ()
isEmptyTChan :: TChan a -> STM Bool
TChans
data TChan a
`TChan` is an abstract type representing an unbounded FIFO channel.
newTChan :: STM (TChan a)
Build and returns a new instance of `TChan`
newTChanIO :: IO (TChan a)
`IO` version of `newTChan`. This is useful for creating top-level `TChan`s using `unsafePerformIO`, because using `atomically` inside `unsafePerformIO` isn't possible.
readTChan :: TChan a -> STM a
Read the next value from the `TChan`.
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.
isEmptyTChan :: TChan a -> STM Bool
Returns `True` if the supplied `TChan` is empty.
Produced by Haddock version 0.8