From 4cf293837fe2f1393d387a280f30c359e8ff4ae3 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 23 May 2014 12:35:18 +0200 Subject: [PATCH] Change the default number of threads for the ThreadPool class. Fixes #6279 --- lib/base/threadpool.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/base/threadpool.cpp b/lib/base/threadpool.cpp index 456192058..d79ec2cb2 100644 --- a/lib/base/threadpool.cpp +++ b/lib/base/threadpool.cpp @@ -22,8 +22,8 @@ #include "base/debug.h" #include "base/utility.h" #include "base/exception.h" -#include #include +#include using namespace icinga; @@ -271,8 +271,8 @@ void ThreadPool::ManagerThreadProc(void) int tthreads = wthreads - alive; - /* Don't ever kill the last thread. */ - if (alive + tthreads < 1) + /* Make sure there is at least one thread per CPU */ + if (alive + tthreads < std::max(boost::thread::hardware_concurrency(), 4U)) tthreads = 1 - alive; /* Don't kill more than 8 threads at once. */ -- 2.49.0