Bug 1503055 - Avoid deadlocking when rewinding to avoid a different deadlock, r=mccr8.

--HG--
extra : rebase_source : ce275a13dc60a0b1aeeef81e9bebc9c1b80ccdfa
This commit is contained in:
Brian Hackett 2018-10-29 13:23:33 -10:00
Родитель 274ff66356
Коммит 93804cc834
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -129,7 +129,8 @@ Lock::Find(void* aNativeLock)
{ {
MOZ_RELEASE_ASSERT(IsRecordingOrReplaying()); MOZ_RELEASE_ASSERT(IsRecordingOrReplaying());
AutoReadSpinLock ex(gLocksLock); Maybe<AutoReadSpinLock> ex;
ex.emplace(gLocksLock);
if (gLocks) { if (gLocks) {
LockMap::iterator iter = gLocks->find(aNativeLock); LockMap::iterator iter = gLocks->find(aNativeLock);
@ -147,6 +148,7 @@ Lock::Find(void* aNativeLock)
// held by idling threads that have not diverged from the recording. // held by idling threads that have not diverged from the recording.
// This will cause the process to deadlock, so rewind instead. // This will cause the process to deadlock, so rewind instead.
if (lock->mOwner && Thread::GetById(lock->mOwner)->IsIdle()) { if (lock->mOwner && Thread::GetById(lock->mOwner)->IsIdle()) {
ex.reset();
EnsureNotDivergedFromRecording(); EnsureNotDivergedFromRecording();
Unreachable(); Unreachable();
} }