engine-mk1
Public Member Functions | List of all members
rz::taskscheduler::TaskScheduler Class Reference

Creates and manages worker threads that work on dependency based Task lists. More...

#include <TaskScheduler.hpp>

Public Member Functions

 TaskScheduler () noexcept
 Default constructor. More...
 
 TaskScheduler (const TaskScheduler &)=delete
 
 TaskScheduler (TaskScheduler &&)=delete
 
 ~TaskScheduler ()
 Default destructor. More...
 
TaskScheduleroperator= (const TaskScheduler &)=delete
 
TaskScheduleroperator= (TaskScheduler &&)=delete
 
Task push (WorkFunc work, Task dependency=Task{})
 Pushes a new Task to be scheduled. More...
 
Task push (WorkGroup group, Task dependency=Task{})
 Pushes a group Task to be scheduled. More...
 
Task pushGraph (WorkGraph workGraph, Task dependency=Task{})
 Creates and pushes a series of interdependent Tasks from a WorkGraph. More...
 
void helpWorkers ()
 A function to let the main thread help process Tasks until there are none left. More...
 

Detailed Description

Creates and manages worker threads that work on dependency based Task lists.

For more information and examples, see page TaskScheduler.

Constructor & Destructor Documentation

TaskScheduler::TaskScheduler ( )
noexcept

Default constructor.

TaskScheduler::~TaskScheduler ( )

Default destructor.

Member Function Documentation

void TaskScheduler::helpWorkers ( )

A function to let the main thread help process Tasks until there are none left.

Task TaskScheduler::push ( WorkFunc  work,
Task  dependency = Task{} 
)

Pushes a new Task to be scheduled.

Parameters
workThe work function to be called.
dependency<optional> The Task that must finish before this one can run.
Returns
A copy of the created Task.
Task TaskScheduler::push ( WorkGroup  group,
Task  dependency = Task{} 
)

Pushes a group Task to be scheduled.

The first WorkFunc in the WorkGroup becomes the parent Task, with the remaining WorkFuncs becoming child Tasks of the parent Task.

Parameters
groupThe WorkGroup to be create Tasks from.
dependency<optional> The Task that must finish before this one can run.
Returns
A copy of the parent Task.
Task TaskScheduler::pushGraph ( WorkGraph  workGraph,
Task  dependency = Task{} 
)

Creates and pushes a series of interdependent Tasks from a WorkGraph.

Parameters
workGraphThe Graph of WorkFuncs to convert into Tasks.
dependency<optional> The Task that must finish before this one can run.
Returns
The task generated from the WorkGraph with state == State::GREEN.

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