Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-05-05 00:59:58 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-05-05 15:06:08 +0300
commit4e5a328e556109162b81ec3a388988375a91b0d9 (patch)
treeacf1e4b9ffee67b079714f5ddf5e1dfc9bcb2321 /source/blender/blenlib/intern/task_scheduler.cc
parentc54ced9f5529e2111144f29eadbada215f627fa0 (diff)
Tasks: support build with TBB version 2017
Make the task pool implementation compatible with older versions that are used by install_deps.sh.
Diffstat (limited to 'source/blender/blenlib/intern/task_scheduler.cc')
-rw-r--r--source/blender/blenlib/intern/task_scheduler.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/task_scheduler.cc b/source/blender/blenlib/intern/task_scheduler.cc
index 682fee5c46d..325056d41ee 100644
--- a/source/blender/blenlib/intern/task_scheduler.cc
+++ b/source/blender/blenlib/intern/task_scheduler.cc
@@ -29,18 +29,21 @@
/* Quiet top level deprecation message, unrelated to API usage here. */
# define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
# include <tbb/tbb.h>
+# if TBB_INTERFACE_VERSION_MAJOR >= 10
+# define WITH_TBB_GLOBAL_CONTROL
+# endif
#endif
/* Task Scheduler */
static int task_scheduler_num_threads = 1;
-#ifdef WITH_TBB
+#ifdef WITH_TBB_GLOBAL_CONTROL
static tbb::global_control *task_scheduler_global_control = nullptr;
#endif
void BLI_task_scheduler_init()
{
-#ifdef WITH_TBB
+#ifdef WITH_TBB_GLOBAL_CONTROL
const int num_threads_override = BLI_system_num_threads_override_get();
if (num_threads_override > 0) {
@@ -57,12 +60,14 @@ void BLI_task_scheduler_init()
* at all. */
task_scheduler_num_threads = BLI_system_thread_count();
}
+#else
+ task_scheduler_num_threads = BLI_system_thread_count();
#endif
}
void BLI_task_scheduler_exit()
{
-#ifdef WITH_TBB
+#ifdef WITH_TBB_GLOBAL_CONTROL
OBJECT_GUARDED_DELETE(task_scheduler_global_control, tbb::global_control);
#endif
}