From: Gunnar Beutner Date: Sat, 23 Mar 2013 11:50:07 +0000 (+0100) Subject: Tune thread spawning behavior. X-Git-Tag: v0.0.2~186 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ac65b0a4786769e25f931e9251fd0f572be9548;p=icinga2 Tune thread spawning behavior. --- diff --git a/lib/base/eventqueue.cpp b/lib/base/eventqueue.cpp index 8913903ed..17d4300be 100644 --- a/lib/base/eventqueue.cpp +++ b/lib/base/eventqueue.cpp @@ -180,8 +180,6 @@ void EventQueue::Post(const EventQueueCallback& callback) void EventQueue::ReportThreadProc(void) { - double last_adjustment = 0; - for (;;) { Utility::Sleep(5); @@ -213,13 +211,12 @@ void EventQueue::ReportThreadProc(void) m_Latency = 0; m_LatencyCount = 0; - if (pending > 0) { + if (pending > alive - busy) { /* Spawn a few additional workers. */ for (int i = 0; i < 2; i++) SpawnWorker(); - } else if (last_adjustment < now - 30) { + } else { KillWorker(); - last_adjustment = now; } }