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