Skip to content

Commit

Permalink
Support oneTBB 2021
Browse files Browse the repository at this point in the history
  • Loading branch information
Logarithmus committed Jul 28, 2021
1 parent 7375c99 commit 9079a51
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions opensubdiv/osd/tbbEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
);
}
}

Expand Down

0 comments on commit 9079a51

Please sign in to comment.