HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulestm-2.5.3.1Haskell2010

Control.Concurrent.STM.TQueue

A TQueue is like a TChan, with two important differences:

  • it has faster throughput than both TChan and Chan (although the costs are amortised, so the cost of individual operations can vary a lot).

  • it does not provide equivalents of the dupTChan and cloneTChan operations.

The implementation is based on the traditional purely-functional queue representation that uses two lists to obtain amortised O(1) enqueue and dequeue operations.

  • 1 type
  • 10 values
  • Packagestm-2.5.3.1
  • Exports11
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTQueue.hs

TQueue

11 declarations
datadata TQueue a
#

TQueue is an abstract type representing an unbounded FIFO channel.

Instances1Eq
  • Eq (TQueue a)Defined in stm-2.5.3.1 · Control.Concurrent.STM.TQueue
valueflushTQueue :: TQueue a -> STM [a]
#

Efficiently read the entire contents of a TQueue into a list. This function never retries.

valuepeekTQueue :: TQueue a -> STM a
#

Get the next value from the TQueue without removing it, retrying if the channel is empty.

valueunGetTQueue :: TQueue a -> a -> STM ()
#

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