Blender V5.0
BLI_mutex.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7/* Always include that so that `BLI_mutex.hh` can be used as replacement to including <mutex>.
8 * Otherwise it might be confusing if both are included explicitly in a file. That also makes the
9 * difference between compiling with and without TBB smaller. */
10#include <mutex> // IWYU pragma: export
11
12#ifdef WITH_TBB
13# include <tbb/mutex.h>
14#endif
15
16namespace blender {
17
18#ifdef WITH_TBB
19
39using Mutex = tbb::mutex;
40
41/* If this is not true anymore at some point, the comment above needs to be updated. */
42static_assert(sizeof(Mutex) == 1);
43
44#else
45
47using Mutex = std::mutex;
48
49#endif
50
51} // namespace blender
std::mutex Mutex
Definition BLI_mutex.hh:47