Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- data TQueue a
- newTQueue :: STM (TQueue a)
- newTQueueIO :: IO (TQueue a)
- readTQueue :: TQueue a -> STM a
- tryReadTQueue :: TQueue a -> STM (Maybe a)
- writeTQueue :: TQueue a -> a -> STM ()
- isEmptyTQueue :: TQueue a -> STM Bool
- mkWeakTQueue :: TQueue a -> IO () -> IO (Weak (TQueue a))
Original functionality
TQueue
is an abstract type representing an unbounded FIFO channel.
newTQueueIO :: IO (TQueue a) Source #
IO
version of newTQueue
. This is useful for creating top-level
TQueue
s using unsafePerformIO
, because using
atomically
inside unsafePerformIO
isn't
possible.
tryReadTQueue :: TQueue a -> STM (Maybe a) Source #
A version of readTQueue
which does not retry. Instead it
returns Nothing
if no value is available.