diff --git a/Common/Thread/ThreadManager.cpp b/Common/Thread/ThreadManager.cpp index 2f73531606..482d1d0142 100644 --- a/Common/Thread/ThreadManager.cpp +++ b/Common/Thread/ThreadManager.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -121,7 +122,10 @@ void ThreadManager::EnqueueTaskOnThread(int threadNum, Task *task, TaskType task } int ThreadManager::GetNumLooperThreads() const { - return (int)(global_->threads_.size() / 2); + // If possible, let's use all threads but one for parallel loops. + // Not sure what's the best policy here. Maybe we should just have more threads than CPUs. + int numLooperThreads = (int)(global_->threads_.size()) - 1; + return std::max(numLooperThreads, 1); } void ThreadManager::TryCancelTask(uint64_t taskID) {