commit 3ac08ac200f63e42d6c98a5487082aa7e7b3995f
parent 04d87536764f17267b88cb35106bc468020dcc65
Author: David Goulet <dgoulet@torproject.org>
Date: Mon, 28 Nov 2022 09:33:32 -0500
Merge branch 'tor-gitlab/mr/658'
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/changes/ticket40713 b/changes/ticket40713
@@ -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.
diff --git a/src/core/mainloop/cpuworker.c b/src/core/mainloop/cpuworker.c
@@ -129,7 +129,7 @@ cpu_init(void)
always make sure we have at least two threads, so that there will be at
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,
replyqueue,
worker_state_new,