diff options
| author | frosty <gabriel@bwaaa.monster> | 2026-03-07 01:16:01 -0500 |
|---|---|---|
| committer | frosty <gabriel@bwaaa.monster> | 2026-03-07 01:16:01 -0500 |
| commit | 2f305c8f9c5c9ae28e839500ffa1854948c56928 (patch) | |
| tree | 54a432bebd7efdf8be2bcf4e64993e75ebd5d88c /src | |
| parent | 0a5a3114eccf9b6c2af805f19fda2835ce247abb (diff) | |
| download | beaker-2f305c8f9c5c9ae28e839500ffa1854948c56928.tar.gz | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/server.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server.c b/src/server.c index b623db7..caeb4bf 100644 --- a/src/server.c +++ b/src/server.c @@ -9,7 +9,7 @@ #include <sys/socket.h> #include <unistd.h> #include <pthread.h> -#include <sys/sysinfo.h> +#include <unistd.h> #include <stdlib.h> #include <signal.h> @@ -86,8 +86,9 @@ static int work_queue_pop(WorkQueue *queue) { } static int get_optimal_thread_count(void) { - int cores = get_nprocs(); - return cores * 2; + long cores = sysconf(_SC_NPROCESSORS_ONLN); + if (cores < 1) cores = 1; + return (int)(cores * 2); } void handle_client_connection(int new_socket); |
