Don't kill too many worker threads at once.

Refs #5050
This commit is contained in:
Gunnar Beutner 2013-11-15 14:04:03 +01:00
parent e2a7cb32e5
commit 687c88bea0

View File

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