[icinga-checkins] icinga.org: icinga2/feature/threadpool-bug-5050: Don' t kill too many worker threads at once.

git at icinga.org git at icinga.org
Fri Nov 15 14:04:13 CET 2013


Module: icinga2
Branch: feature/threadpool-bug-5050
Commit: 687c88bea07d535440bd6680c363a86d25a94e6c
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=687c88bea07d535440bd6680c363a86d25a94e6c

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Nov 15 14:04:03 2013 +0100

Don't kill too many worker threads at once.

Refs #5050

---

 lib/base/threadpool.cpp |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/base/threadpool.cpp b/lib/base/threadpool.cpp
index 1e184c3..91facda 100644
--- a/lib/base/threadpool.cpp
+++ b/lib/base/threadpool.cpp
@@ -253,6 +253,10 @@ void ThreadPool::ManagerThreadProc(void)
 				if (alive + tthreads < 8)
 					tthreads = 8 - alive;
 
+				/* Don't kill more than 8 threads at once. */
+				if (tthreads < -8)
+					tthreads = -8;
+
 				/* Spawn more workers if there are outstanding work items. */
 				if (tthreads > 0 && pending > 0)
 					tthreads = (Utility::GetTime() - Application::GetStartTime() < 300) ? 128 : 8;





More information about the icinga-checkins mailing list