mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
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
This commit is contained in:

committed by
Guillaume Roguez

parent
7adf9f4d1e
commit
e0cf7a6682
@ -32,7 +32,7 @@ struct ThreadPool::ThreadState
|
||||
};
|
||||
|
||||
ThreadPool::ThreadPool()
|
||||
: maxThreads_(std::thread::hardware_concurrency())
|
||||
: maxThreads_(std::max<size_t>(std::thread::hardware_concurrency(), 4))
|
||||
{
|
||||
threads_.reserve(maxThreads_);
|
||||
}
|
||||
|
Reference in New Issue
Block a user