Beatmup
|
Conditional multiple tasks execution. More...
#include <multitask.h>
Public Types | |
enum class | RepetitionPolicy { REPEAT_ALWAYS , REPEAT_UPDATE , IGNORE_IF_UPTODATE , IGNORE_ALWAYS } |
Determines when a specific task in the sequence is run when the whole sequence is invoked. More... | |
Public Types inherited from Beatmup::AbstractTask | |
enum class | TaskDeviceRequirement { CPU_ONLY , GPU_OR_CPU , GPU_ONLY } |
Specifies which device (CPU and/or GPU) is used to run the task. More... | |
Public Member Functions | |
Multitask () | |
RepetitionPolicy | getRepetitionPolicy (const TaskHolder &) |
void | setRepetitionPolicy (TaskHolder &taskHolder, RepetitionPolicy policy) |
Sets repetition policy of a task. More... | |
Public Member Functions inherited from Beatmup::CustomPipeline | |
~CustomPipeline () | |
int | getTaskCount () const |
TaskHolder & | getTask (int) const |
Retrieves a task by its index. More... | |
int | getTaskIndex (const TaskHolder &) |
Retrieves task index if it is in the pipeline; returns -1 otherwise. More... | |
TaskHolder & | addTask (AbstractTask &) |
Adds a new task to the end of the pipeline. More... | |
TaskHolder & | insertTask (AbstractTask &task, const TaskHolder &before) |
Inserts a task in a specified position of the pipeline before another task. More... | |
bool | removeTask (const TaskHolder &task) |
Removes a task from the pipeline. More... | |
void | measure () |
Determines pipeline execution mode and required thread count. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Protected Member Functions | |
TaskHolder * | createTaskHolder (AbstractTask &task) |
bool | route (TaskRouter &router) |
Protected Member Functions inherited from Beatmup::CustomPipeline | |
TaskDeviceRequirement | getUsedDevices () const |
Communicates devices (CPU and/or GPU) the task is run on. More... | |
ThreadIndex | getMaxThreads () const |
Gives the upper limint on the number of threads the task may be performed by. More... | |
void | beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu) |
Instruction called before the task is executed. More... | |
void | afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted) |
Instruction called after the task is executed. More... | |
bool | process (TaskThread &thread) |
Executes the task on CPU within a given thread. More... | |
bool | processOnGPU (GraphicPipeline &gpu, TaskThread &thread) |
Executes the task on GPU. More... | |
CustomPipeline () | |
Private Attributes | |
std::mutex | policyAccess |
access control to modify repetition policies More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Beatmup::AbstractTask | |
static ThreadIndex | validThreadCount (int number) |
Valid thread count from a given integer value. More... | |
Conditional multiple tasks execution.
Multitask is a technique to build complex multi-stage image processing pipelines. It allows to concatenate different tasks into a linear conveyor and run them all or selectively. To handle this selection, each task is associated with a repetition policy specifying the conditions whether this given task is executed or ignored when the pipeline is running.
Specifically, it implements two extreme modes that force the task execution every time (Multitask::RepetitionPolicy::REPEAT_ALWAYS) or its unconditional skipping (Multitask::RepetitionPolicy::IGNORE_ALWAYS) and two more sophisticated modes:
Definition at line 48 of file multitask.h.
|
strong |
Determines when a specific task in the sequence is run when the whole sequence is invoked.
Definition at line 60 of file multitask.h.
Multitask::Multitask | ( | ) |
Definition at line 76 of file multitask.cpp.
|
protectedvirtual |
Implements Beatmup::CustomPipeline.
Definition at line 42 of file multitask.cpp.
|
protectedvirtual |
Implements Beatmup::CustomPipeline.
Definition at line 46 of file multitask.cpp.
Multitask::RepetitionPolicy Multitask::getRepetitionPolicy | ( | const TaskHolder & | task | ) |
Definition at line 78 of file multitask.cpp.
void Multitask::setRepetitionPolicy | ( | TaskHolder & | taskHolder, |
RepetitionPolicy | policy | ||
) |
Sets repetition policy of a task.
If the pipeline is processing at the moment of the call, it is the application responsibility to abort and restart it, if the policy change needs to be applied immediately.
taskHolder | TaskHolder of a task to apply the policy to |
policy | The new policy |
Definition at line 85 of file multitask.cpp.
|
private |
access control to modify repetition policies
Definition at line 50 of file multitask.h.