Bug 1208957 - No need for a condvar for thread shutdown.
Now that we join on the thread exiting, we no longer need to have the thread
explicitly tell us it's shutting down.
MozReview-Commit-ID: LycPjUvyeX
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -995,22 +995,23 @@ class Watchdog
{ // Scoped lock.
AutoLockWatchdog lock(this);
// Signal to the watchdog thread that it's time to shut down.
mShuttingDown = true;
// Wake up the watchdog, and wait for it to call us back.
PR_NotifyCondVar(mWakeup);
- PR_WaitCondVar(mWakeup, PR_INTERVAL_NO_TIMEOUT);
- MOZ_ASSERT(!mShuttingDown);
}
PR_JoinThread(mThread);
+ // The thread sets mShuttingDown to false as it exits.
+ MOZ_ASSERT(!mShuttingDown);
+
// Destroy state.
mThread = nullptr;
PR_DestroyCondVar(mWakeup);
mWakeup = nullptr;
PR_DestroyLock(mLock);
mLock = nullptr;
// All done.
@@ -1039,17 +1040,16 @@ class Watchdog
{
MOZ_ASSERT(!NS_IsMainThread());
MOZ_ALWAYS_TRUE(PR_WaitCondVar(mWakeup, timeout) == PR_SUCCESS);
}
void Finished()
{
MOZ_ASSERT(!NS_IsMainThread());
mShuttingDown = false;
- PR_NotifyCondVar(mWakeup);
}
int32_t MinScriptRunTimeSeconds()
{
return mMinScriptRunTimeSeconds;
}
private: