Commit f7a731ab authored by Nathan Froyd's avatar Nathan Froyd
Browse files

Bug 1573160 - shutdown newly-spawned threads if we're shutting down; r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D41551

--HG--
extra : moz-landing-system : lando
parent 76f9a8c8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -117,7 +117,9 @@ nsresult nsThreadPool::PutEvent(already_AddRefed<nsIRunnable> aEvent,
  bool killThread = false;
  {
    MutexAutoLock lock(mMutex);
    if (mThreads.Count() < (int32_t)mThreadLimit) {
    if (mShutdown) {
      killThread = true;
    } else if (mThreads.Count() < (int32_t)mThreadLimit) {
      mThreads.AppendObject(thread);
    } else {
      killThread = true;  // okay, we don't need this thread anymore