HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WorkTaskGraph::BaseTask Class Referenceabstract

#include <taskGraph.h>

+ Inheritance diagram for WorkTaskGraph::BaseTask:

Public Member Functions

 BaseTask ()=default
 
virtual WORK_API ~BaseTask ()
 
virtual BaseTaskexecute ()=0
 
void AddChildReference ()
 
int RemoveChildReference ()
 
template<typename F , typename... Args>
F * AllocateChild (Args &&...args)
 
- Public Member Functions inherited from WorkTaskGraph_DefaultImpl::BaseTask
 BaseTask ()=default
 
WORK_API void operator() (const int depth=0, WorkTaskGraph_DefaultImpl *const taskGraph=nullptr) const
 
void AddChildReference ()
 
int RemoveChildReference ()
 
template<typename F , typename... Args>
F * AllocateChild (Args &&...args)
 

Protected Member Functions

void _RecycleAsContinuation ()
 
- Protected Member Functions inherited from WorkTaskGraph_DefaultImpl::BaseTask
void _RecycleAsContinuation ()
 

Detailed Description

Base class for a parallel task that emulates tbb::task (deprecated in the oneTBB version upgrade.) This task abstracts a block of concurrent work by exploiting knowledge of TBB's task-based work stealing scheduler architecture to provide memory and runtime optimizations.

This is a callable object that can serve as an anchor to dynamically spawn additional children. It supports continuation passing, recycling of task resources, and scheduler bypass. All task graph tasks are heap-allocated and automatically released/reclaimed using reference counting.

Definition at line 106 of file taskGraph.h.

Constructor & Destructor Documentation

WorkTaskGraph::BaseTask::BaseTask ( )
default
virtual WORK_API WorkTaskGraph::BaseTask::~BaseTask ( )
virtual

Member Function Documentation

void WorkTaskGraph::BaseTask::_RecycleAsContinuation ( )
inlineprotected

Recycles this as a continuation task to mitigate the allocation overhead of the continuation task.

Note
Note that the task graph performs safe continuation passing by default, i.e. it assumes an extra increment of the child reference count to handle the case when the continued task returns before a longer-lived child task. In this case, the extra reference prevents the continuation task from executing prematurely and orphaning its running child task.

Definition at line 147 of file taskGraph.h.

void WorkTaskGraph::BaseTask::AddChildReference ( )
inline

Increment the reference count of child tasks that must complete before this task can proceed.

Definition at line 120 of file taskGraph.h.

template<typename F , typename... Args>
F* WorkTaskGraph::BaseTask::AllocateChild ( Args &&...  args)
inline

Construct a new subtask and increment the reference count of the calling task.

Definition at line 133 of file taskGraph.h.

int WorkTaskGraph::BaseTask::RemoveChildReference ( )
inline

Decrement the reference count of child tasks that must complete before this task can proceed.

Definition at line 126 of file taskGraph.h.


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