|
HDK
|
#include <dispatcher.h>
Inheritance diagram for WorkDispatcher:Additional Inherited Members | |
Public Member Functions inherited from Work_Dispatcher< PXR_WORK_IMPL_NS::WorkImpl_Dispatcher > | |
| Work_Dispatcher (Work_Dispatcher const &)=delete | |
| WORK_API | ~Work_Dispatcher () noexcept |
| Wait() for any pending tasks to complete, then destroy the dispatcher. More... | |
| Work_Dispatcher & | operator= (Work_Dispatcher const &)=delete |
| void | Run (Callable &&c) |
| void | Run (Callable &&c, A0 &&a0, Args &&...args) |
| WORK_API void | Wait () |
| Block until the work started by Run() completes. More... | |
| WORK_API void | Cancel () |
| WORK_API bool | IsCancelled () const |
Public Member Functions inherited from Work_Dispatcher< Impl > | |
| WORK_API | ~Work_Dispatcher () noexcept |
| Wait() for any pending tasks to complete, then destroy the dispatcher. More... | |
| Work_Dispatcher (Work_Dispatcher const &)=delete | |
| Work_Dispatcher & | operator= (Work_Dispatcher const &)=delete |
| template<class Callable > | |
| void | Run (Callable &&c) |
| template<class Callable , class A0 , class... Args> | |
| void | Run (Callable &&c, A0 &&a0, Args &&...args) |
| WORK_API void | Wait () |
| Block until the work started by Run() completes. More... | |
| WORK_API void | Cancel () |
| WORK_API bool | IsCancelled () const |
Protected Member Functions inherited from Work_Dispatcher< PXR_WORK_IMPL_NS::WorkImpl_Dispatcher > | |
| WORK_API | Work_Dispatcher () |
Protected Member Functions inherited from Work_Dispatcher< Impl > | |
| WORK_API | Work_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 221 of file dispatcher.h.