snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 090a28ba4e15c8d1996a872bed8df902bd6fb4c3
parent 308a0e0f64094b58d0b1ba8e99c09bf710ed1ca0
Author: default <nobody@localhost>
Date:   Thu,  9 Feb 2023 08:09:55 +0100

The number of threads can be forced from the config file.

Diffstat:
Mhttpd.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/httpd.c b/httpd.c @@ -420,9 +420,13 @@ void httpd(void) sem_init(&job_sem, 0, 0); job_fifo = xs_list_new(); + n_threads = xs_number_get(xs_dict_get(srv_config, "num_threads")); + #ifdef _SC_NPROCESSORS_ONLN - /* get number of CPUs on the machine */ - n_threads = sysconf(_SC_NPROCESSORS_ONLN); + if (n_threads == 0) { + /* get number of CPUs on the machine */ + n_threads = sysconf(_SC_NPROCESSORS_ONLN); + } #endif if (n_threads < 4)