Change the default number of threads for the ThreadPool class.

Fixes #6279
This commit is contained in:
Gunnar Beutner 2014-05-23 12:35:18 +02:00
parent 5ec300f68e
commit 4cf293837f
1 changed files with 3 additions and 3 deletions

View File

@ -22,8 +22,8 @@
#include "base/debug.h" #include "base/debug.h"
#include "base/utility.h" #include "base/utility.h"
#include "base/exception.h" #include "base/exception.h"
#include <iostream>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <iostream>
using namespace icinga; using namespace icinga;
@ -271,8 +271,8 @@ void ThreadPool::ManagerThreadProc(void)
int tthreads = wthreads - alive; int tthreads = wthreads - alive;
/* Don't ever kill the last thread. */ /* Make sure there is at least one thread per CPU */
if (alive + tthreads < 1) if (alive + tthreads < std::max(boost::thread::hardware_concurrency(), 4U))
tthreads = 1 - alive; tthreads = 1 - alive;
/* Don't kill more than 8 threads at once. */ /* Don't kill more than 8 threads at once. */