Loading...
Searching...
No Matches
VdfParallelTaskSync Class Reference

Instances of this class are used to synchronize dynamic, acyclic task graphs, allowing tasks to claim dependents for processing. More...

#include <parallelTaskSync.h>

Public Types

enum class  State { Done , Wait , Claimed }
 The different states a task can be in. More...
 

Public Member Functions

 VdfParallelTaskSync (const VdfParallelTaskSync &)=delete
 Noncopyable.
 
VdfParallelTaskSyncoperator= (const VdfParallelTaskSync &)=delete
 
 VdfParallelTaskSync (WorkTaskGraph *taskGraph)
 Constructor.
 
VDF_API void Reset (const size_t num)
 Resets the state of all tasks in the graph.
 
State Claim (const size_t idx, WorkTaskGraph::BaseTask *successor)
 Claims the task idx for processing, and returns the new task state.
 
void MarkDone (const size_t idx)
 Mark the task idx as done.
 

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

◆ State

enum class State
strong

The different states a task can be in.

Enumerator
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() [1/2]

Noncopyable.

◆ VdfParallelTaskSync() [2/2]

VdfParallelTaskSync ( WorkTaskGraph taskGraph)
inline

Constructor.

Definition at line 44 of file parallelTaskSync.h.

Member Function Documentation

◆ Claim()

VdfParallelTaskSync::State 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.

◆ MarkDone()

void 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.

◆ Reset()

VDF_API void 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: