Skip to content

Commit

Permalink
Do not create a tbb::global_control when embree device is initialized…
Browse files Browse the repository at this point in the history
… without specifying thread count
  • Loading branch information
dopitz committed Dec 12, 2024
1 parent c7d6668 commit 0f0915f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions common/tasking/taskschedulertbb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ namespace embree
/* first terminate threads in case we configured them */
if (g_tbb_threads_initialized) {
#if TBB_INTERFACE_VERSION >= 11005
delete g_tbb_thread_control;
g_tbb_thread_control = nullptr;
if (numThreads != std::numeric_limits<size_t>::max()) {
delete g_tbb_thread_control;
g_tbb_thread_control = nullptr;
}
#else
g_tbb_threads.terminate();
#endif
Expand All @@ -53,7 +55,9 @@ namespace embree
const size_t max_concurrency = threadCount();
if (numThreads > max_concurrency) numThreads = max_concurrency;
#if TBB_INTERFACE_VERSION >= 11005
g_tbb_thread_control = new tbb::global_control(tbb::global_control::max_allowed_parallelism,numThreads);
if (numThreads != std::numeric_limits<size_t>::max()) {
g_tbb_thread_control = new tbb::global_control(tbb::global_control::max_allowed_parallelism, numThreads);
}
#else
g_tbb_threads.initialize(int(numThreads));
#endif
Expand Down

0 comments on commit 0f0915f

Please sign in to comment.