Kill newly-spawned threads if we're shutting down.
This commit is contained in:
parent
3ebbfc6e8f
commit
be98cb90b7
|
@ -112,7 +112,9 @@ nsThreadPool::PutEvent(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags)
|
||||||
bool killThread = false;
|
bool killThread = false;
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mMutex);
|
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);
|
mThreads.AppendObject(thread);
|
||||||
} else {
|
} else {
|
||||||
killThread = true; // okay, we don't need this thread anymore
|
killThread = true; // okay, we don't need this thread anymore
|
||||||
|
|
Loading…
Reference in New Issue
Block a user