Blender  V3.3
tbb.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #ifndef __UTIL_TBB_H__
5 #define __UTIL_TBB_H__
6 
7 /* TBB includes <windows.h>, do it ourselves first so we are sure
8  * WIN32_LEAN_AND_MEAN and similar are defined beforehand. */
9 #include "util/windows.h"
10 
11 #include <tbb/enumerable_thread_specific.h>
12 #include <tbb/parallel_for.h>
13 #include <tbb/parallel_for_each.h>
14 #include <tbb/task_arena.h>
15 #include <tbb/task_group.h>
16 
17 #if TBB_INTERFACE_VERSION_MAJOR >= 10
18 # define WITH_TBB_GLOBAL_CONTROL
19 # define TBB_PREVIEW_GLOBAL_CONTROL 1
20 # include <tbb/global_control.h>
21 #endif
22 
24 
25 using tbb::blocked_range;
26 using tbb::enumerable_thread_specific;
27 using tbb::parallel_for;
29 
30 static inline void thread_capture_fp_settings()
31 {
32 #if TBB_INTERFACE_VERSION_MAJOR >= 12
33  tbb::task_group_context *ctx = tbb::task::current_context();
34 #else
35  tbb::task_group_context *ctx = tbb::task::self().group();
36 #endif
37  if (ctx) {
38  ctx->capture_fp_settings();
39  }
40 }
41 
42 static inline void parallel_for_cancel()
43 {
44 #if TBB_INTERFACE_VERSION_MAJOR >= 12
45  tbb::task_group_context *ctx = tbb::task::current_context();
46  if (ctx) {
47  ctx->cancel_group_execution();
48  }
49 #else
50  tbb::task::self().cancel_group_execution();
51 #endif
52 }
53 
55 
56 #endif /* __UTIL_TBB_H__ */
PyObject * self
Definition: bpy_driver.c:165
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
void parallel_for(IndexRange range, int64_t grain_size, const Function &function)
Definition: BLI_task.hh:51
void parallel_for_each(Range &range, const Function &function)
Definition: BLI_task.hh:39
static void thread_capture_fp_settings()
Definition: tbb.h:30
static void parallel_for_cancel()
Definition: tbb.h:42