Copyright | (c) FP Complete 2018 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <alexey@fpcomplete.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Synopsis
- data TBFQueue a
- newTBFQueue :: Natural -> STM (TBFQueue a)
- newTBFQueueIO :: Natural -> IO (TBFQueue a)
- writeTBFQueue :: TBFQueue a -> a -> STM ()
- tryWriteTBFQueue :: TBFQueue a -> a -> STM Bool
- readTBFQueue :: TBFQueue a -> STM a
- takeTBFQueue :: Natural -> TBFQueue a -> STM [a]
- flushTBFQueue :: TBFQueue a -> STM [a]
- lengthTBFQueue :: TBFQueue a -> STM Natural
- isEmptyTBFQueue :: TBFQueue a -> STM Bool
Documentation
Bounded Flush Queue. It's a queue that allows pushing elements onto, popping elements from it, but is mostly optimizied for flushing the queue or taking in bulk.
Construct a new empty Flush Bounded Queue
Construct a new empty Flush Bounded Queue inside IO monad.
writeTBFQueue :: TBFQueue a -> a -> STM () Source #
O(1) - Push an element onto the queue. Will block if maximum bound has been reached.
readTBFQueue :: TBFQueue a -> STM a Source #
Amortized O(1) - Pop an element from the queue. Will block if queue is empty.
takeTBFQueue :: Natural -> TBFQueue a -> STM [a] Source #
O(i) - Take i
elements from the queue, unblock all the possible writers and return all the
elements from the queue in FIFO order.
flushTBFQueue :: TBFQueue a -> STM [a] Source #
O(n) - Flush the queue, unblock all the possible writers and return all the elements from the queue in FIFO order.