diff options
Diffstat (limited to 'source/blender/blenlib/intern/task_scheduler.cc')
-rw-r--r-- | source/blender/blenlib/intern/task_scheduler.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/task_scheduler.cc b/source/blender/blenlib/intern/task_scheduler.cc index b22334a5676..69117e9dc7e 100644 --- a/source/blender/blenlib/intern/task_scheduler.cc +++ b/source/blender/blenlib/intern/task_scheduler.cc @@ -28,6 +28,7 @@ #ifdef WITH_TBB /* Need to include at least one header to get the version define. */ # include <tbb/blocked_range.h> +# include <tbb/task_arena.h> # if TBB_INTERFACE_VERSION_MAJOR >= 10 # include <tbb/global_control.h> # define WITH_TBB_GLOBAL_CONTROL @@ -76,3 +77,12 @@ int BLI_task_scheduler_num_threads() { return task_scheduler_num_threads; } + +void BLI_task_isolate(void (*func)(void *userdata), void *userdata) +{ +#ifdef WITH_TBB + tbb::this_task_arena::isolate([&] { func(userdata); }); +#else + func(userdata); +#endif +} |