Merge branch 'tor-gitlab/mr/658'

This commit is contained in:
David Goulet 2022-11-28 09:33:32 -05:00
commit 3ac08ac200
2 changed files with 5 additions and 1 deletions

4
changes/ticket40713 Normal file
View File

@ -0,0 +1,4 @@
o Minor feature (cpuworker):
- Always use the number of threads for our CPU worker pool to the number of
core available but cap it to a minimum of 2 in case of a single core.
Fixes bug 40713; bugfix on 0.3.5.1-alpha.

View File

@ -129,7 +129,7 @@ cpu_init(void)
always make sure we have at least two threads, so that there will be at always make sure we have at least two threads, so that there will be at
least one thread of each kind. least one thread of each kind.
*/ */
const int n_threads = get_num_cpus(get_options()) + 1; const int n_threads = MAX(get_num_cpus(get_options()), 2);
threadpool = threadpool_new(n_threads, threadpool = threadpool_new(n_threads,
replyqueue, replyqueue,
worker_state_new, worker_state_new,