From 9a072b13ff3c51598883c085f5ea6ad48510a6b6 Mon Sep 17 00:00:00 2001 From: Daniel M <daniel.q.mueller@stud.h-da.de> Date: Tue, 11 May 2021 18:24:51 +0200 Subject: [PATCH] Minor fixes - Fix include error in httpd.hpp. - Fix threadpool zero workers with 1 core. --- src/httpd.hpp | 2 ++ src/threadpool.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/httpd.hpp b/src/httpd.hpp index c675685..faaa55d 100644 --- a/src/httpd.hpp +++ b/src/httpd.hpp @@ -6,6 +6,8 @@ #include <unordered_map> #include <functional> +#include <netinet/in.h> + #include "http_err.hpp" #include "http_request.hpp" #include "http_response.hpp" diff --git a/src/threadpool.cpp b/src/threadpool.cpp index 4ed3ec1..9dc25e0 100644 --- a/src/threadpool.cpp +++ b/src/threadpool.cpp @@ -21,6 +21,8 @@ Threadpool::Threadpool(int _numberOfWorkers, int _maxQueueBacklog) // is double the amount of physical cores. So on a modern machine with hyperthreading // the number of worker threads will be equivalent to the number of "real" cpu cores numberOfWorkers = std::thread::hardware_concurrency() / 2; + + if (numberOfWorkers < 1) numberOfWorkers = 1; } if (maxQueueBacklog != DISABLE_MAX_QUEUE_BACKLOG) -- GitLab