Blender V4.5
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#pragma once
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#ifdef _WIN32
10# include "util/windows.h"
11#endif
12
13#include <tbb/enumerable_thread_specific.h>
14#include <tbb/parallel_for.h>
15#include <tbb/parallel_for_each.h>
16#include <tbb/parallel_reduce.h>
17#include <tbb/task_arena.h>
18#include <tbb/task_group.h>
19
20#if TBB_INTERFACE_VERSION_MAJOR >= 10
21# define WITH_TBB_GLOBAL_CONTROL
22# define TBB_PREVIEW_GLOBAL_CONTROL 1
23# include <tbb/global_control.h>
24#endif
25
27
28using tbb::blocked_range;
29using tbb::enumerable_thread_specific;
30using tbb::parallel_for;
31using tbb::parallel_for_each;
32using tbb::parallel_reduce;
33
34static inline void thread_capture_fp_settings()
35{
36#if TBB_INTERFACE_VERSION_MAJOR >= 12
37 tbb::task_group_context *ctx = tbb::task::current_context();
38#else
39 tbb::task_group_context *ctx = tbb::task::self().group();
40#endif
41 if (ctx) {
42 ctx->capture_fp_settings();
43 }
44}
45
46static inline void parallel_for_cancel()
47{
48#if TBB_INTERFACE_VERSION_MAJOR >= 12
49 tbb::task_group_context *ctx = tbb::task::current_context();
50 if (ctx) {
51 ctx->cancel_group_execution();
52 }
53#else
54 tbb::task::self().cancel_group_execution();
55#endif
56}
57
#define CCL_NAMESPACE_END
static void thread_capture_fp_settings()
Definition tbb.h:34
static void parallel_for_cancel()
Definition tbb.h:46