bug 1035075 - orderly shutdown of pac thread r=sworkman

This commit is contained in:
Patrick McManus 2014-07-18 16:44:24 -04:00
parent bacbafa425
commit d9fd068b46

View File

@ -287,6 +287,14 @@ nsPACMan::Shutdown()
CancelExistingLoad();
mShutdown = true;
PostCancelPendingQ(NS_ERROR_ABORT);
// this can't return until pac thread is joined
LOG(("nsPACMan::Shutdown Thread shutdown start %p", mPACThread.get()));
if (mPACThread) {
mPACThread->Shutdown();
mPACThread = nullptr;
}
LOG(("nsPACMan::Shutdown Thread shutdown finish"));
}
nsresult
@ -494,11 +502,12 @@ nsPACMan::ProcessPendingQ()
NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread");
while (ProcessPending());
if (mShutdown) {
mPAC.Shutdown();
} else {
// do GC while the thread has nothing pending
mPAC.GC();
if (mShutdown)
mPAC.Shutdown();
}
}
// returns true if progress was made by shortening the queue