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