TQueue is an abstract type representing an unbounded FIFO channel.
Moduleconcurrency-1.11.0.3Haskell2010
Control.Concurrent.Classy.STM.TQueue
A TQueue is like a TChan, with two important differences:
it has faster throughput than both
TChanandChan(although the costs are amortised, so the cost of individual operations can vary a lot).it does not provide equivalents of the
dupTChanandcloneTChanoperations.
The implementation is based on the traditional purely-functional queue representation that uses two lists to obtain amortised O(1) enqueue and dequeue operations.
Deviations: TQueue as defined here does not have an Eq
instance, this is because the MonadSTM TVar type does not have
an Eq constraint. Furthermore, the newTQueueIO function is not
provided.
Contents
Synopsis
- data TQueue
- value newTQueue
- value readTQueue
- value tryReadTQueue
- value flushTQueue
- value peekTQueue
- value tryPeekTQueue
- value writeTQueue
- value unGetTQueue
- value isEmptyTQueue
- Packageconcurrency-1.11.0.3
- Exports10
- LanguageHaskell2010
- LicenceMIT
- SourceTQueue.hs
TQueue
Build and returns a new instance of TQueue
Read the next value from the TQueue.
A version of readTQueue which does not retry. Instead it
returns Nothing if no value is available.
Efficiently read the entire contents of a TQueue into a list. This function never retries.
Get the next value from the TQueue without removing it,
retrying if the channel is empty.
A version of peekTQueue which does not retry. Instead it
returns Nothing if no value is available.
Write a value to a TQueue.
Put a data item back onto a channel, where it will be the next item read.