summaryrefslogtreecommitdiffstats
path: root/xpcom/threads/nsThreadPool.cpp
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@mozilla.com>2019-09-04 17:55:04 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-09-04 17:55:04 +0200
commit4266966eeef44dfce422b9703692e519678610c6 (patch)
tree4dba75458909612679e7c28837a12e5712bbbcac /xpcom/threads/nsThreadPool.cpp
parentc6446f1126232935c85397aac493113dd38496cd (diff)
downloadUXP-4266966eeef44dfce422b9703692e519678610c6.tar
UXP-4266966eeef44dfce422b9703692e519678610c6.tar.gz
UXP-4266966eeef44dfce422b9703692e519678610c6.tar.lz
UXP-4266966eeef44dfce422b9703692e519678610c6.tar.xz
UXP-4266966eeef44dfce422b9703692e519678610c6.zip
Kill newly-spawned threads if we're shutting down.
Diffstat (limited to 'xpcom/threads/nsThreadPool.cpp')
-rw-r--r--xpcom/threads/nsThreadPool.cpp4
1 files changed, 3 insertions, 1 deletions
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<nsIRunnable> 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