summaryrefslogtreecommitdiff
path: root/graphics/opensubdiv/files/patch-opensubdiv_osd_tbbEvaluator.cpp
blob: c8b44e2c7c656d8cd60ed03ed586a93ad2564745 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- opensubdiv/osd/tbbEvaluator.cpp.orig	2021-12-17 16:59:23 UTC
+++ opensubdiv/osd/tbbEvaluator.cpp
@@ -25,7 +25,8 @@
 #include "../osd/tbbEvaluator.h"
 #include "../osd/tbbKernel.h"
 
-#include <tbb/task_scheduler_init.h>
+#define TBB_PREVIEW_GLOBAL_CONTROL true
+#include <tbb/global_control.h>
 
 namespace OpenSubdiv {
 namespace OPENSUBDIV_VERSION {
@@ -215,10 +216,11 @@ TbbEvaluator::Synchronize(void *) {
 /* static */
 void
 TbbEvaluator::SetNumThreads(int numThreads) {
-    if (numThreads == -1) {
-        tbb::task_scheduler_init init;
-    } else {
-        tbb::task_scheduler_init init(numThreads);
+    if (numThreads != -1) {
+        tbb::global_control tbb_global_control(
+            tbb::global_control::max_allowed_parallelism,
+            numThreads
+            );
     }
 }