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

#include <isolatingDispatcher.h>

+ Inheritance diagram for WorkIsolatingDispatcher:

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_Dispatcheroperator= (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_Dispatcheroperator= (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 ()
 

Detailed Description

The isolating work dispatcher is a specialization of WorkDispatcher, mirroring its public API and documented behaviors.

However, the WorkIsolatingDispatcher imposes additional restrictions on how it processes its concurrent tasks: Tasks added to the dispatcher will only be run by this dispatcher, or nested instances of non-isolating WorkDispatcher. Moreover, in its Wait() method, the WorkIsolatingDispatcher will not run tasks that were not originally added to this dispatcher, or one of its nested, non-isolating WorkDispatcher instances.

For work implementations that support work stealing (e.g., OneTBB) the WorkIsolatingDispatcher effectively prevents unrelated tasks from being stolen by this dispatcher, as well as dispatcher tasks being stolen by unrelated parallel constructs (unless they are non-isolating and nested within one of the tasks of this dispatcher).

Note
Enforcing the work stealing prevention behavior of the WorkIsolatingDispatcher carries significant additional cost. Using the WorkDispatcher is preferred in most cases, unless the isolation behavior is required, and the scoping semantics of WorkWithScopedParallelism() are insufficient for the particular use-case.

For more information, refer to the documentation for WorkDispatcher.

Definition at line 47 of file isolatingDispatcher.h.


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