mirror of https://github.com/Icinga/icinga2.git
Change the default number of threads for the ThreadPool class.
Fixes #6279
This commit is contained in:
parent
5ec300f68e
commit
4cf293837f
|
@ -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. */
|
||||||
|
|
Loading…
Reference in New Issue