gang-of-threads-3.2.1: Non-deterministic parallelism with bags

PortabilityPOSIX
Stabilityexperimental
Maintainerbastianholst@gmx.de
Safe HaskellNone

Control.Concurrent.Bag.ImplicitConcurrent

Description

High level bag of tasks interface based on Control.Concurrent.Bag.Concurrent. Tasks can only return results and add new tasks as intended and it is not possible to add new tasks from the outside or from the action processing the results.

Synopsis

Documentation

newTaskBagSource

Arguments

:: BufferType

buffer type

-> [TaskIO r (Maybe r)]

list of initial tasks

-> IO [r]

lazy result list

Build and start a new task bag.

The returned list is not evaluated yet, but will be evaluated on demand later. Already computed results will be kept in a buffer until the result list is evaluated. If the result list gets garbage collected, the bag of tasks will be stopped automatically.

newEvalBag :: BufferType -> [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.

newInterruptingBagSource

Arguments

:: BufferType

buffer type

-> [Interruptible r]

list of initial tasks

-> IO [r]

lazy result list

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.

newInterruptibleBagSource

Arguments

:: BufferType

buffer type

-> [Interruptible r]

list of initial tasks

-> IO [r]

lazy result list

Similar to newTaskBag, but taking a list of Interruptible instead of tasks.

data BufferType Source

The type of a buffer. At this time you can only select between Queue and Stack.

Constructors

Queue

A first in first out (FIFO) buffer.

Stack

A last in first out (LIFO) buffer.