-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Concurrent batching queue based on STM with timeout. -- -- Please see the README on GitHub at -- https://github.com/harporoeder/concurrent-batch#readme @package concurrent-batch @version 0.1.0.0 module Control.Concurrent.STM.Batch -- | Opaque batch with buffer and settings. data Batch a -- | Constructs a new batcher state. If a batch timeout is configured this -- operation will automatically spawn a timeout handler thread. The -- timeout handler will automatically be killed when the batcher is -- garbage collected. newBatch :: Int -> Maybe TimeSpec -> ([a] -> STM ()) -> IO (Batch a) -- | Add a single item to the batch. The batch is automatically flushed -- when full. writeBatch :: Batch a -> a -> IO () -- | Fires the batchHandler for the current batch from the current thread. -- This function is automatically called for a timeout or when buffer is -- filled by a write operation. flushBatch :: Batch a -> STM () -- | Convenience function for timeout in milliseconds. fromMilliSecs :: Integer -> TimeSpec -- | Convenience function for timeout in seconds. fromSecs :: Integer -> TimeSpec -- | Highest resolution time supported by internal usage of -- threadDelay. fromMicroSecs :: Integer -> TimeSpec -- | TimeSpec structure data TimeSpec TimeSpec :: {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> TimeSpec -- | seconds [sec] :: TimeSpec -> {-# UNPACK #-} !Int64 -- | nanoseconds [nsec] :: TimeSpec -> {-# UNPACK #-} !Int64