gang-of-threads-3.2.1: Non-deterministic parallelism with bags

PortabilityPOSIX
Stabilityexperimental
Maintainerbastianholst@gmx.de
Safe HaskellSafe-Inferred

Control.Concurrent.STM.TStack

Description

A simple stack implementation with an concurrent STM access functions similar to that of TChan. In contrast to TChan, which is a FIFO buffer, TStack is a LIFO buffer.

Synopsis

Documentation

data TStack a Source

Concurrent STM stakc.

newTStack :: STM (TStack a)Source

Build and return a new instance of TStack.

writeTStack :: TStack a -> a -> STM ()Source

Write a value into the TStack.

readTStack :: TStack a -> STM aSource

Read the next value from the TStack.

isEmptyTStack :: TStack a -> STM BoolSource

Check whether the TStack is empty.

tryReadTStack :: TStack a -> STM (Maybe a)Source

Try to read the next value from the TStack.