Tune thread spawning behavior.

This commit is contained in:
Gunnar Beutner 2013-03-23 12:50:07 +01:00
parent d04a04d897
commit 7ac65b0a47
1 changed files with 2 additions and 5 deletions

View File

@ -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;
}
}