зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1402595 - Don't wait on cooperative thread cvar after marking the current thread as having finished, r=jandem.
This commit is contained in:
Родитель
4b36b816ed
Коммит
bd8854975b
|
@ -3383,7 +3383,7 @@ CooperativeEndWait(JSContext* cx)
|
|||
}
|
||||
|
||||
static void
|
||||
CooperativeYield()
|
||||
CooperativeYield(bool terminating = false)
|
||||
{
|
||||
LockGuard<Mutex> lock(cooperationState->lock);
|
||||
MOZ_ASSERT(!cooperationState->idle);
|
||||
|
@ -3392,7 +3392,7 @@ CooperativeYield()
|
|||
|
||||
// Wait until another thread takes over control before returning, if there
|
||||
// is another thread to do so.
|
||||
if (cooperationState->numThreads) {
|
||||
if (!terminating && cooperationState->numThreads) {
|
||||
uint64_t count = cooperationState->yieldCount;
|
||||
cooperationState->cvar.wait(lock, [&] { return cooperationState->yieldCount != count; });
|
||||
}
|
||||
|
@ -3552,7 +3552,7 @@ WorkerMain(void* arg)
|
|||
js_delete(sc);
|
||||
if (input->siblingContext) {
|
||||
cooperationState->numThreads--;
|
||||
CooperativeYield();
|
||||
CooperativeYield(/* terminating = */ true);
|
||||
}
|
||||
js_delete(input);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче