Skip to content
Snippets Groups Projects
Commit e0cf7a66 authored by Adrien Béraud's avatar Adrien Béraud Committed by Guillaume Roguez
Browse files

thread pool: add minimum size of 4 threads

rationale: a minimum thread pool size of N allows up to N dependent
tasks to block on each other without resulting in a deadlock on monothread
systems, while limiting the number of concurrent running tasks.
Ring currently uses up to two dependent tasks with ThreadPool.

Change-Id: I66ec6ebb64ee4e1fb84af2db9aa465c62e08eadd
parent 7adf9f4d
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ struct ThreadPool::ThreadState ...@@ -32,7 +32,7 @@ struct ThreadPool::ThreadState
}; };
ThreadPool::ThreadPool() ThreadPool::ThreadPool()
: maxThreads_(std::thread::hardware_concurrency()) : maxThreads_(std::max<size_t>(std::thread::hardware_concurrency(), 4))
{ {
threads_.reserve(maxThreads_); threads_.reserve(maxThreads_);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment