Copyright | Copyright © 2013-2015 PivotCloud, Inc. |
---|---|
License | Apache-2.0 |
Maintainer | Jon Sterling <jsterling@alephcloud.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- class BoundedCloseableQueue q α | q -> α where
- newQueue :: Natural -> IO q
- closeQueue :: q -> IO ()
- writeQueue :: q -> α -> IO Bool
- tryWriteQueue :: q -> α -> IO (Maybe Bool)
- readQueue :: q -> IO (Maybe α)
- takeQueueTimeout :: q -> Natural -> Natural -> IO [α]
- isEmptyQueue :: q -> IO Bool
- isClosedQueue :: q -> IO Bool
- isClosedAndEmptyQueue :: q -> IO Bool
Documentation
class BoundedCloseableQueue q α | q -> α where Source
A signature for bounded, closeable queues.
newQueue, closeQueue, writeQueue, tryWriteQueue, readQueue, takeQueueTimeout, isEmptyQueue, isClosedQueue
closeQueue :: q -> IO () Source
writeQueue :: q -> α -> IO Bool Source
Returns False
if and only if the queue is closed. If the queue is full
this function shall block.
tryWriteQueue :: q -> α -> IO (Maybe Bool) Source
Non-blocking version of writeQueue
. Returns Nothing
if the queue was
full. Otherwise it returns 'Just True' if the value was successfully
written and 'Just False' if the queue was closed.
readQueue :: q -> IO (Maybe α) Source
Returns Nothing
if and only if the queue is closed. If this queue is
empty this function blocks.
Take up to n
items from the queue with a timeout of t
.
isEmptyQueue :: q -> IO Bool Source
Whether the queue is empty.
isClosedQueue :: q -> IO Bool Source
Whether the queue is closed.
isClosedAndEmptyQueue :: q -> IO Bool Source
Whether the queue is empty and closed. The trivial default implementation may be overridden with one which provides transactional guarantees.
BoundedCloseableQueue (TBMChan a) a | |
BoundedCloseableQueue (TBMQueue a) a |