From 687c88bea07d535440bd6680c363a86d25a94e6c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 15 Nov 2013 14:04:03 +0100 Subject: [PATCH] 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 1e184c3ba..91facda70 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;