Commit 4b36b816 authored by Brian Hackett's avatar Brian Hackett
Browse files

Bug 1412298 - Wait for cooperative threads before worker threads when shutting...

Bug 1412298 - Wait for cooperative threads before worker threads when shutting down the JS shell, r=jandem.
parent b12e853f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
if (helperThreadCount() === 0)
  quit();
evalInCooperativeThread(`
      const dbg = new Debugger();
      evalInWorker("");
`);
+7 −7
Original line number Diff line number Diff line
@@ -3925,6 +3925,13 @@ KillWorkerThreads(JSContext* cx)
{
    MOZ_ASSERT_IF(!CanUseExtraThreads(), workerThreads.empty());

    // Yield until all other cooperative threads in the main runtime finish.
    while (cooperationState->numThreads) {
        CooperativeBeginWait(cx);
        CooperativeYield();
        CooperativeEndWait(cx);
    }

    if (!workerThreadsLock) {
        MOZ_ASSERT(workerThreads.empty());
        return;
@@ -3947,13 +3954,6 @@ KillWorkerThreads(JSContext* cx)
    js_delete(workerThreadsLock);
    workerThreadsLock = nullptr;

    // Yield until all other cooperative threads in the main runtime finish.
    while (cooperationState->numThreads) {
        CooperativeBeginWait(cx);
        CooperativeYield();
        CooperativeEndWait(cx);
    }

    js_delete(cooperationState);
    cooperationState = nullptr;
}