priority-sync-0.2.1.1: Cooperative task prioritization.

PrioritySync.Internal.TaskPool

Description

A prioritized TaskPool. This consists of a Queue, which prioritizes tasks, and a Room which restricts the number of tasks that may execute at one time.

Synopsis

Documentation

data TaskPool p u Source

Instances

schedule :: TaskPool p u -> p -> Schedule p (Constrained (TaskPoolConstraint u), Room (TaskPoolConstraint u))Source

A prioritized ClaimContext for a task pool.

newTaskPool :: Ord p => QueueConfigurationRecord p -> Int -> u -> IO (TaskPool p u)Source

Create a new TaskPool. TaskPools begin stopped, use startQueue to start.

Consider using simpleTaskPool if you have no special needs.

simpleTaskPool :: Ord p => IO (TaskPool p ())Source

Just create a new TaskPool. The task pool is constrained by the number of capabilities indicated by numCapabilities.

poolRoom :: TaskPool p u -> Room (TaskPoolConstraint u)Source

Get the Room that primarily constrains this TaskPool.

poolQueue :: TaskPool p u -> Queue pSource

Get the Queue that admits new tasks to this TaskPool.

startQueue :: TaskPool p u -> STM ()Source

Start the TaskPool.

stopQueue :: TaskPool p u -> STM ()Source

Stop all activity on this TaskPool.

isEmpty :: Ord p => TaskPool p u -> STM BoolSource

True iff this TaskPool is entirely empty and inactive.

waitUntilFinished :: Ord p => TaskPool p u -> IO ()Source

Wait until a queue is finished.