aboutsummaryrefslogtreecommitdiff
path: root/src/core/mainloop
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-11-23 13:40:47 -0500
committerDavid Goulet <dgoulet@torproject.org>2022-11-23 13:52:36 -0500
commitb9de73e46ea86de1ca1e4810cd14ea21c81acfc8 (patch)
treed083f1072a85cd19dfe320876c1ee09769b9deba /src/core/mainloop
parent8713d9762a79c46829891cafbcf1a972f0946065 (diff)
downloadtor-b9de73e46ea86de1ca1e4810cd14ea21c81acfc8.tar.gz
tor-b9de73e46ea86de1ca1e4810cd14ea21c81acfc8.zip
cpu: Set number of threads to number of cores
Cap this to 2 threads always because we need a low and high priority thread even with a single core. Fixes #40713 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core/mainloop')
-rw-r--r--src/core/mainloop/cpuworker.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/mainloop/cpuworker.c b/src/core/mainloop/cpuworker.c
index 3ad556a184..0459f22efe 100644
--- 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,