An abstract scheduler, sorts and executes tasks with one or more threads. More...
#include <Scheduler.h>
Public Member Functions | |
Scheduler (const char *type) | |
Creates a new scheduler. | |
virtual | ~Scheduler () |
Deletes this scheduler. | |
virtual bool | supportsPrefetch (bool gpuTasks)=0 |
Returns true if this scheduler can execute CPU or GPU tasks whose deadline is not immediate. | |
virtual void | schedule (ptr< Task > task)=0 |
Adds a task whose deadline is not immediate. | |
virtual void | reschedule (ptr< Task > task, Task::reason r, unsigned int deadline)=0 |
Forces the reexecution of the given task and of its sub tasks. | |
virtual void | run (ptr< Task > task)=0 |
Executes the given tasks. | |
Protected Member Functions | |
void | swap (ptr< Scheduler > s) |
Swaps this scheduler with the given one. |
An abstract scheduler, sorts and executes tasks with one or more threads.
ork::Scheduler::Scheduler | ( | const char * | type | ) |
Creates a new scheduler.
type | the type of this scheduler. |
virtual ork::Scheduler::~Scheduler | ( | ) | [virtual] |
Deletes this scheduler.
virtual void ork::Scheduler::reschedule | ( | ptr< Task > | task, | |
Task::reason | r, | |||
unsigned int | deadline | |||
) | [pure virtual] |
Forces the reexecution of the given task and of its sub tasks.
task | a task or task graph that must be reexecuted. This task is marked as undone (with Task::setIsDone) so that it will be reexecuted. | |
r | the reason why the task must be reexecuted. | |
deadline | the frame number before which this task must be reexecuted. |
Implemented in ork::MultithreadScheduler.
Executes the given tasks.
This method does not return before all tasks with an immediate deadline are completed.
task | a task or task graph to be executed. |
Implemented in ork::MultithreadScheduler.
Adds a task whose deadline is not immediate.
This method must not be called if this scheduler does not support prefetch (see supportsPrefetch). Otherwise it adds this task and its sub tasks to the list of tasks to be executed by this scheduler, and returns immediately (i.e. before these tasks are executed).
task | a task or task graph whose deadline is not immediate. |
Implemented in ork::MultithreadScheduler.
virtual bool ork::Scheduler::supportsPrefetch | ( | bool | gpuTasks | ) | [pure virtual] |
Returns true if this scheduler can execute CPU or GPU tasks whose deadline is not immediate.
This means tasks whose result will be needed in the next few frames, but that are known in advance and could be computed ahead of time to reduce the load of these coming frames.
gpuTasks | true to know if this scheduler can prefetch GPU tasks, or false to know if it can prefetch CPU tasks. |
Implemented in ork::MultithreadScheduler.