distributed-process-0.5.3: Cloud Haskell: Erlang-style concurrency in Haskell

Safe HaskellNone
LanguageHaskell98

Control.Distributed.Process.Internal.WeakTQueue

Contents

Description

Clone of Control.Concurrent.STM.TQueue with support for mkWeakTQueue

Not all functionality from the original module is available: unGetTQueue, peekTQueue and tryPeekTQueue are missing. In order to implement these we'd need to be able to touch# the write end of the queue inside unGetTQueue, but that means we need a version of touch# that works within the STM monad.

Synopsis

Original functionality

data TQueue a Source

TQueue is an abstract type representing an unbounded FIFO channel.

Instances

Eq (TQueue a) 
Typeable (* -> *) TQueue 

newTQueue :: STM (TQueue a) Source

Build and returns a new instance of TQueue

newTQueueIO :: IO (TQueue a) Source

IO version of newTQueue. This is useful for creating top-level TQueues using unsafePerformIO, because using atomically inside unsafePerformIO isn't possible.

readTQueue :: TQueue a -> STM a Source

Read the next value from the TQueue.

tryReadTQueue :: TQueue a -> STM (Maybe a) Source

A version of readTQueue which does not retry. Instead it returns Nothing if no value is available.

writeTQueue :: TQueue a -> a -> STM () Source

Write a value to a TQueue.

isEmptyTQueue :: TQueue a -> STM Bool Source

Returns True if the supplied TQueue is empty.

New functionality

mkWeakTQueue :: TQueue a -> IO () -> IO (Weak (TQueue a)) Source