HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VdfParallelTaskSync Class Reference

Instances of this class are used to synchronize dynamic, acyclic task graphs, allowing tasks to claim dependents for processing. Methods on this class are thread-safe unless specifically called out to not be thread-safe. More...

#include <parallelTaskSync.h>

Public Types

enum  State { State::Done, State::Wait, State::Claimed }
 

Public Member Functions

 VdfParallelTaskSync (const VdfParallelTaskSync &)=delete
 
VdfParallelTaskSyncoperator= (const VdfParallelTaskSync &)=delete
 
 VdfParallelTaskSync (WorkTaskGraph *taskGraph)
 
VDF_API void Reset (const size_t num)
 
State Claim (const size_t idx, WorkTaskGraph::BaseTask *successor)
 
void MarkDone (const size_t idx)
 

Detailed Description

Instances of this class are used to synchronize dynamic, acyclic task graphs, allowing tasks to claim dependents for processing. Methods on this class are thread-safe unless specifically called out to not be thread-safe.

Definition at line 34 of file parallelTaskSync.h.

Member Enumeration Documentation

The different states a task can be in.

Enumerator
Done 
Wait 

The task is already done.

Claimed 

The task is currently running, the claimant must wait for the task to complete. The task has been successfully claimed. The claimant can go ahead and process the task.

Definition at line 61 of file parallelTaskSync.h.

Constructor & Destructor Documentation

VdfParallelTaskSync::VdfParallelTaskSync ( const VdfParallelTaskSync )
delete

Noncopyable.

VdfParallelTaskSync::VdfParallelTaskSync ( WorkTaskGraph taskGraph)
inline

Constructor.

Definition at line 44 of file parallelTaskSync.h.

Member Function Documentation

VdfParallelTaskSync::State VdfParallelTaskSync::Claim ( const size_t  idx,
WorkTaskGraph::BaseTask successor 
)
inline

Claims the task idx for processing, and returns the new task state.

This method will automatically increment the reference count of the successor, if the task has already been claimed, and will cause the reference count of successor to be automatically decremented as soon as the task completes.

Definition at line 116 of file parallelTaskSync.h.

void VdfParallelTaskSync::MarkDone ( const size_t  idx)
inline

Mark the task idx as done.

This method will notify any tasks depending on idx about the completion of idx.

Definition at line 141 of file parallelTaskSync.h.

VdfParallelTaskSync& VdfParallelTaskSync::operator= ( const VdfParallelTaskSync )
delete
VDF_API void VdfParallelTaskSync::Reset ( const size_t  num)

Resets the state of all tasks in the graph. Ensures that num entries are available for use.

It is not thread-safe to call this method on the same instance from multiple threads.


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