Copyright | (c) FP Complete 2018 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <alexey@fpcomplete.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Control.Concurrent.BFQueue
Description
Bouded Flush Queue is a very efficient queue that supports pushing elements concurrently, but has no support for popping elements from the queue. The only way to get elements from the queue is to flush it and get all the elements in FIFO order.
Synopsis
- data BFQueue a
- newBFQueue :: Natural -> IO (BFQueue a)
- writeBFQueue :: BFQueue a -> a -> IO ()
- tryWriteBFQueue :: BFQueue a -> a -> IO Bool
- takeBFQueue :: Natural -> BFQueue a -> IO [a]
- flushBFQueue :: BFQueue a -> IO [a]
- lengthBFQueue :: BFQueue a -> IO Natural
- isEmptyBFQueue :: BFQueue a -> IO Bool
Documentation
Bounded Flush Queue. It's a queue that allows pushing elements onto, but popping elements is not an option. Only flushing or non-blocking taking from the queue will make space for new elements and unlbock any concurrent writers..
writeBFQueue :: BFQueue a -> a -> IO () Source #
O(1) - Push an element onto the queue. Will block if maximum bound has been reached.
takeBFQueue :: Natural -> BFQueue a -> IO [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.
flushBFQueue :: BFQueue a -> IO [a] Source #
O(n) - Flush the queue, unblock all the possible writers and return all the elements from the queue in FIFO order.