Safe Haskell | None |
---|
- module Control.Concurrent.Bag.Task
- newTaskBag :: BufferType -> Maybe (SplitFunction r) -> [TaskIO r (Maybe r)] -> IO [r]
- newEvalBag :: BufferType -> Maybe (SplitFunction r) -> [r] -> IO [r]
- type SplitFunction r = TaskBufferSTM (IO (Maybe r)) -> TaskBufferSTM (IO (Maybe r)) -> STM (IO (Maybe r))
- takeFirst :: SplitFunction r
- newInterruptingBag :: BufferType -> Maybe (SplitFunction r) -> [Interruptible r] -> IO [r]
- newInterruptibleBag :: BufferType -> Maybe (SplitFunction r) -> [Interruptible r] -> IO [r]
- data BufferType
Documentation
module Control.Concurrent.Bag.Task
:: BufferType | |
-> Maybe (SplitFunction r) | Possible split function If the function is given, we will create a bag with one buffer per worker reducing the communication between the workers. |
-> [TaskIO r (Maybe r)] | list of initial tasks |
-> IO [r] |
newEvalBag :: BufferType -> Maybe (SplitFunction r) -> [r] -> IO [r]Source
Like newTaskBag
, but it takes a list of expressions that will be
evaluated to weak head normal form using seq
.
__WARNING__: This does not evaluate to normal form, but only to weak head normal form.
type SplitFunction r = TaskBufferSTM (IO (Maybe r)) -> TaskBufferSTM (IO (Maybe r)) -> STM (IO (Maybe r))Source
newInterruptingBag :: BufferType -> Maybe (SplitFunction r) -> [Interruptible r] -> IO [r]Source
Similar to newTaskBag
, but interrupts the tasks in certain intervals.
Using a TChan
as buffer, this ensures
completeness: all tasks that have a result will get their time to evaluate
it. Note, that calculations, that do no memory allocation, cannot be
interrupted.
newInterruptibleBag :: BufferType -> Maybe (SplitFunction r) -> [Interruptible r] -> IO [r]Source
data BufferType Source