HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
isolatingDispatcher.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_BASE_WORK_ISOLATING_DISPATCHER_H
8 #define PXR_BASE_WORK_ISOLATING_DISPATCHER_H
9 
10 /// \file
11 
12 #include "pxr/pxr.h"
13 
15 #include "pxr/base/work/impl.h"
16 
18 
19 /// \class WorkIsolatingDispatcher
20 /// \extends Work_Dispatcher
21 ///
22 /// The isolating work dispatcher is a specialization of WorkDispatcher,
23 /// mirroring its public API and documented behaviors.
24 ///
25 /// However, the WorkIsolatingDispatcher imposes additional restrictions on
26 /// how it processes its concurrent tasks: Tasks added to the dispatcher will
27 /// only be run by this dispatcher, or nested instances of non-isolating
28 /// WorkDispatcher. Moreover, in its Wait() method, the WorkIsolatingDispatcher
29 /// will not run tasks that were not originally added to this dispatcher, or
30 /// one of its nested, non-isolating WorkDispatcher instances.
31 ///
32 /// For work implementations that support work stealing (e.g., OneTBB) the
33 /// WorkIsolatingDispatcher effectively prevents unrelated tasks from being
34 /// stolen by this dispatcher, as well as dispatcher tasks being stolen by
35 /// unrelated parallel constructs (unless they are non-isolating and nested
36 /// within one of the tasks of this dispatcher).
37 ///
38 /// \note
39 /// Enforcing the work stealing prevention behavior of the
40 /// WorkIsolatingDispatcher carries significant additional cost. Using the
41 /// WorkDispatcher is preferred in most cases, unless the isolation behavior is
42 /// required, and the scoping semantics of WorkWithScopedParallelism() are
43 /// insufficient for the particular use-case.
44 ///
45 /// For more information, refer to the documentation for WorkDispatcher.
46 ///
48 #if defined WORK_IMPL_HAS_ISOLATING_DISPATCHER
49  public Work_Dispatcher<PXR_WORK_IMPL_NS::WorkImpl_IsolatingDispatcher>
50 #else
51  public Work_Dispatcher<PXR_WORK_IMPL_NS::WorkImpl_Dispatcher>
52 #endif
53 {};
54 
56 
57 #endif
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74