Portability | non-portable (CPP, STM, DeriveDataTypeable) |
---|---|
Stability | provisional |
Maintainer | wren@community.haskell.org |
Safe Haskell | Trustworthy |
Compatibility layer for older versions of the stm
library.
Namely, we copy Control.Concurrent.STM.TQueue module which
stm < 2.4.0
lacks. This module uses Cabal-style CPP macros in
order to use the package versions when available.
Since: 2.0.0
- data TQueue a
- newTQueue :: STM (TQueue a)
- newTQueueIO :: IO (TQueue a)
- readTQueue :: TQueue a -> STM a
- tryReadTQueue :: TQueue a -> STM (Maybe a)
- peekTQueue :: TQueue a -> STM a
- tryPeekTQueue :: TQueue a -> STM (Maybe a)
- writeTQueue :: TQueue a -> a -> STM ()
- unGetTQueue :: TQueue a -> a -> STM ()
- isEmptyTQueue :: TQueue a -> STM Bool
The TQueue type
Creating TQueues
newTQueueIO :: IO (TQueue a)
IO
version of newTQueue
. This is useful for creating top-level
TQueue
s using unsafePerformIO
, because using
atomically
inside unsafePerformIO
isn't
possible.
Reading from TQueues
readTQueue :: TQueue a -> STM a
Read the next value from the TQueue
.
tryReadTQueue :: TQueue a -> STM (Maybe a)
A version of readTQueue
which does not retry. Instead it
returns Nothing
if no value is available.
peekTQueue :: TQueue a -> STM a
Get the next value from the TQueue
without removing it,
retrying if the channel is empty.
tryPeekTQueue :: TQueue a -> STM (Maybe a)
A version of peekTQueue
which does not retry. Instead it
returns Nothing
if no value is available.
Writing to TQueues
writeTQueue :: TQueue a -> a -> STM ()
Write a value to a TQueue
.
unGetTQueue :: TQueue a -> a -> STM ()
Put a data item back onto a channel, where it will be the next item read.