Bug 1664020 - ShutdownEvent::PostAndWait should return immediately if posting the event fails r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D89648
This commit is contained in:
Valentin Gosu 2020-09-14 09:27:42 +00:00
parent fd749e52c8
commit a8fed672cb

View File

@ -544,12 +544,18 @@ class ShutdownEvent : public Runnable {
void PostAndWait() {
MonitorAutoLock mon(mMonitor);
DebugOnly<nsresult> rv;
rv = CacheFileIOManager::gInstance->mIOThread->Dispatch(
nsresult rv = CacheFileIOManager::gInstance->mIOThread->Dispatch(
this,
CacheIOThread::WRITE); // When writes and closing of handles is done
MOZ_ASSERT(NS_SUCCEEDED(rv));
// If we failed to post the even there's no reason to go into the loop
// because mNotified will never be set to true.
if (NS_FAILED(rv)) {
NS_WARNING("Posting ShutdownEvent task failed");
return;
}
TimeDuration waitTime = TimeDuration::FromSeconds(1);
while (!mNotified) {
mon.Wait(waitTime);