24#ifndef PXR_BASE_WORK_WITH_SCOPED_PARALLELISM_H
25#define PXR_BASE_WORK_WITH_SCOPED_PARALLELISM_H
30#include "pxr/base/work/api.h"
32#include "pxr/base/tf/pyLock.h"
34#include <tbb/task_arena.h>
38PXR_NAMESPACE_OPEN_SCOPE
116WorkWithScopedParallelism(Fn &&fn,
bool dropPythonGIL=
true)
119 TF_PY_ALLOW_THREADS_IN_SCOPE();
120 return tbb::this_task_arena::isolate(std::forward<Fn>(fn));
123 return tbb::this_task_arena::isolate(std::forward<Fn>(fn));
135WorkWithScopedDispatcher(Fn &&fn,
bool dropPythonGIL=
true)
137 return WorkWithScopedParallelism([&fn]() {
139 return std::forward<Fn>(fn)(dispatcher);
144PXR_NAMESPACE_CLOSE_SCOPE
A work dispatcher runs concurrent tasks.