| VRS - The Virtual Rendering System |
| version 3.3 |
#include <vrs/mt/taskmanager.h>
Static Public Member Functions | |
| template<class RESULT_TYPE> | |
| static SO< Task< RESULT_TYPE > > | AddTask (SO< CallbackR< RESULT_TYPE > > taskCallback, double priority=0.5, double cancelIfNotStartedWithinSeconds=0.0) |
| Add a new task (represented by a callback) to the manager. | |
| template<class RESULT_TYPE> | |
| static SO< Task< RESULT_TYPE > > | AddResult (const RESULT_TYPE &result) |
| Sometimes it could be useful to provide an already calculated result via the task interface. | |
| static size_t | QueuedTasks () |
| Returns the number of queued tasks. | |
| static void | CancelAllTasks () |
| Removes all not yet started tasks from the task list and tries to cancel all running tasks. | |
Static Protected Member Functions | |
| static void | ScheduleTask (SO< TaskBase > task) |
| Implements the task scheduling. | |
| static void | DispatchTasks () |
| Implements the task dispatching. | |
| static void | Initialize () |
| Implements the initialization of internal data structures. | |
| static SO<Task<RESULT_TYPE> > VRS::MT::TaskManager::AddTask | ( | SO< CallbackR< RESULT_TYPE > > | taskCallback, | |
| double | priority = 0.5, |
|||
| double | cancelIfNotStartedWithinSeconds = 0.0 | |||
| ) | [inline, static] |
Add a new task (represented by a callback) to the manager.
This task will be scheduled for execution in a multi threaded environment. The task will be enqueued in a task list with respect to its priority. The priority must be between 0.0 and 1.0; 0.0 being the lowest priority and 1.0 being the highest priority. If the task cannot be started within the given amount of seconds (> 0.0) after adding it to the task queue, the task will be automatically canceled again.
| static SO<Task<RESULT_TYPE> > VRS::MT::TaskManager::AddResult | ( | const RESULT_TYPE & | result | ) | [inline, static] |
Sometimes it could be useful to provide an already calculated result via the task interface.
This method does not add the task to the task queue, because the result is already known.
| static size_t VRS::MT::TaskManager::QueuedTasks | ( | ) | [static] |
Returns the number of queued tasks.
| static void VRS::MT::TaskManager::CancelAllTasks | ( | ) | [static] |
Removes all not yet started tasks from the task list and tries to cancel all running tasks.
The call returns after canceling or finishing all already started tasks.
Implements the task scheduling.
| static void VRS::MT::TaskManager::DispatchTasks | ( | ) | [static, protected] |
Implements the task dispatching.
| static void VRS::MT::TaskManager::Initialize | ( | ) | [static, protected] |
Implements the initialization of internal data structures.