From 4266966eeef44dfce422b9703692e519678610c6 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 4 Sep 2019 17:55:04 +0200 Subject: Kill newly-spawned threads if we're shutting down. --- xpcom/threads/nsThreadPool.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'xpcom/threads') diff --git a/xpcom/threads/nsThreadPool.cpp b/xpcom/threads/nsThreadPool.cpp index 241fad39d..eb967870a 100644 --- a/xpcom/threads/nsThreadPool.cpp +++ b/xpcom/threads/nsThreadPool.cpp @@ -112,7 +112,9 @@ nsThreadPool::PutEvent(already_AddRefed aEvent, uint32_t aFlags) bool killThread = false; { MutexAutoLock lock(mMutex); - if (mThreads.Count() < (int32_t)mThreadLimit) { + if (mShutdown) { + killThread = true; // we're in shutdown, kill the thread + } else if (mThreads.Count() < (int32_t)mThreadLimit) { mThreads.AppendObject(thread); } else { killThread = true; // okay, we don't need this thread anymore -- cgit v1.2.3