From 7ac65b0a4786769e25f931e9251fd0f572be9548 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 23 Mar 2013 12:50:07 +0100 Subject: [PATCH] Tune thread spawning behavior. --- lib/base/eventqueue.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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; } }