Fix of PrusaSlicer hangs on Linux when run with non standard task affinity #5661

This commit is contained in:
Vojtech Bubnik 2021-01-04 09:03:49 +01:00
parent ef5df08358
commit b002c1485d

View File

@ -11,9 +11,9 @@
#include <mutex> #include <mutex>
#include <tbb/parallel_for.h> #include <tbb/parallel_for.h>
#include <tbb/tbb_thread.h> #include <tbb/tbb_thread.h>
#include <tbb/task_arena.h>
#include <tbb/task_scheduler_init.h> #include <tbb/task_scheduler_init.h>
#include "Thread.hpp" #include "Thread.hpp"
namespace Slic3r { namespace Slic3r {
@ -195,7 +195,10 @@ void name_tbb_thread_pool_threads()
return; return;
initialized = true; initialized = true;
const size_t nthreads_hw = std::thread::hardware_concurrency(); // see GH issue #5661 PrusaSlicer hangs on Linux when run with non standard task affinity
// TBB will respect the task affinity mask on Linux and spawn less threads than std::thread::hardware_concurrency().
// const size_t nthreads_hw = std::thread::hardware_concurrency();
const size_t nthreads_hw = tbb::this_task_arena::max_concurrency();
size_t nthreads = nthreads_hw; size_t nthreads = nthreads_hw;
#ifdef SLIC3R_PROFILE #ifdef SLIC3R_PROFILE