![]() |
|
A work dispatcher runs concurrent tasks. More...
#include <dispatcher.h>
Inherits Work_Dispatcher< Impl >, and Work_Dispatcher< PXR_WORK_IMPL_NS::WorkImpl_Dispatcher >.
A work dispatcher runs concurrent tasks.
The dispatcher supports adding new tasks from within running tasks. This suits problems that exhibit hierarchical structured parallelism: tasks that discover additional tasks during their execution.
Typical use is to create a dispatcher and invoke Run() to begin doing work, then Wait() for the work to complete. Tasks may invoke Run() during their execution as they discover additional tasks to perform.
For example,
Calls to Run() and Cancel() may be made concurrently. Calls to Wait() may also be made concurrently. However, once any calls to Wait() are in-flight, calls to Run() and Cancel() must only be made by tasks already added by Run(). This means that users of this class are responsible to synchronize concurrent calls to Wait() to ensure this requirement is met.
Additionally, Wait() must never be called by a task added by Run(), since that task could never complete.
Definition at line 174 of file dispatcher.h.