diff --git a/httplib.h b/httplib.h index 6a1c228..f401a9a 100644 --- a/httplib.h +++ b/httplib.h @@ -49,7 +49,9 @@ #endif #ifndef CPPHTTPLIB_THREAD_POOL_COUNT -#define CPPHTTPLIB_THREAD_POOL_COUNT (std::thread::hardware_concurrency()) +// if hardware_concurrency() outputs 0 we still wants to use threads for this. +// -1 because we have one thread already in the main function. +#define CPPHTTPLIB_THREAD_POOL_COUNT std::thread::hardware_concurrency() ? std::thread::hardware_concurrency()-1 : 2 #endif /*