DotMP
Package Functions | Static Private Attributes | List of all members
DotMP.TaskingContainer Class Reference

A simple container for a Queue<Action> for managing tasks. Will grow in complexity as dependencies are added and a dependency graph must be generated. More...

Collaboration diagram for DotMP.TaskingContainer:
Collaboration graph
[legend]

Package Functions

 TaskingContainer ()
 Default constructor. More...
 
void ResetDAG ()
 Resets the DAG to a default state. Allows the garbage collector to collect unused data. More...
 
void ResetDAGNotThreadSafe ()
 Resets the DAG to a default state. Allows the garbage collector to collect unused data. Unlike ResetDAG(), this version is not thread-safe! More...
 
bool GetNextTask (out Action action, out ulong uuid, out int tasks_remaining)
 Gets the next task from the queue. More...
 
TaskUUID EnqueueTask (Action action, TaskUUID[] depends)
 Enqueues a task to the queue. More...
 
TaskUUID EnqueueTaskloopTask (int start, int end, Action< int > action, TaskUUID[] depends)
 Enqueues a taskloop task to the task queue. More...
 
void CompleteTask (ulong uuid)
 Mark task as completed to remove as a dependency in the DAG. More...
 
bool TaskIsComplete (ulong uuid)
 Determines if a task has been completed. More...
 

Static Private Attributes

static DAG< ulong, Action > dag = new DAG<ulong, Action>()
 DAG of tasks that must execute. We use a DAG in order to maintain dependency chains. More...
 

Detailed Description

A simple container for a Queue<Action> for managing tasks. Will grow in complexity as dependencies are added and a dependency graph must be generated.

Constructor & Destructor Documentation

◆ TaskingContainer()

DotMP.TaskingContainer.TaskingContainer ( )
inlinepackage

Default constructor.

Member Function Documentation

◆ CompleteTask()

void DotMP.TaskingContainer.CompleteTask ( ulong  uuid)
inlinepackage

Mark task as completed to remove as a dependency in the DAG.

Parameters
uuidUUID of task to remove as a dependency.

◆ EnqueueTask()

TaskUUID DotMP.TaskingContainer.EnqueueTask ( Action  action,
TaskUUID[]  depends 
)
inlinepackage

Enqueues a task to the queue.

Parameters
actionThe task to enqueue.
dependsList of task dependencies.
Returns
Task generated from the enqueue task action.

◆ EnqueueTaskloopTask()

TaskUUID DotMP.TaskingContainer.EnqueueTaskloopTask ( int  start,
int  end,
Action< int >  action,
TaskUUID[]  depends 
)
inlinepackage

Enqueues a taskloop task to the task queue.

Parameters
startThe start of the current taskloop task, inclusive.
endThe end of the current taskloop task, exclusive.
actionThe action to be executed.
dependsList of task dependencies.
Returns
Task generated from this iteration of the taskloop.

◆ GetNextTask()

bool DotMP.TaskingContainer.GetNextTask ( out Action  action,
out ulong  uuid,
out int  tasks_remaining 
)
inlinepackage

Gets the next task from the queue.

Parameters
actionThe body of the task to be executed.
uuidThe UUID of the task to be executed.
tasks_remainingThe number of tasks remaining in the queue.
Returns
Whether or not the action was successful.

◆ ResetDAG()

void DotMP.TaskingContainer.ResetDAG ( )
inlinepackage

Resets the DAG to a default state. Allows the garbage collector to collect unused data.

◆ ResetDAGNotThreadSafe()

void DotMP.TaskingContainer.ResetDAGNotThreadSafe ( )
inlinepackage

Resets the DAG to a default state. Allows the garbage collector to collect unused data. Unlike ResetDAG(), this version is not thread-safe!

◆ TaskIsComplete()

bool DotMP.TaskingContainer.TaskIsComplete ( ulong  uuid)
inlinepackage

Determines if a task has been completed.

Parameters
uuidThe ID of the task to check completion.
Returns
Whether or not the task has been completed.

Member Data Documentation

◆ dag

DAG<ulong, Action> DotMP.TaskingContainer.dag = new DAG<ulong, Action>()
staticprivate

DAG of tasks that must execute. We use a DAG in order to maintain dependency chains.


The documentation for this class was generated from the following file: