stm-io-hooks-0.0.1: An STM monad with IO hooks

Portabilitynon-portable (requires STM)
Stabilityexperimental
MaintainerPeter Robinson <robinson@ecs.tuwien.ac.at>

Control.Concurrent.AdvSTM.TChan

Description

Synopsis

Documentation

data TChan a Source

TChan is an abstract type representing an unbounded FIFO channel.

newTChan :: AdvSTM (TChan a)Source

Build and returns a new instance of TChan

newTChanIO :: IO (TChan a)Source

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.

readTChan :: TChan a -> AdvSTM aSource

Read the next value from the TChan.

writeTChan :: TChan a -> a -> AdvSTM ()Source

Write a value to a TChan.

dupTChan :: TChan a -> AdvSTM (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 :: TChan a -> a -> AdvSTM ()Source

Put a data item back onto a channel, where it will be the next item read.

isEmptyTChan :: TChan a -> AdvSTM BoolSource

Returns True if the supplied TChan is empty.