Bug 1568410 - (part 9) Verify ownedByCurrentThread() using owningThread_ r=jandem

We can add an extra assertion here.

Differential Revision: https://phabricator.services.mozilla.com/D43005

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Bone 2019-09-03 06:31:56 +00:00
parent 8d8305ccf5
commit 17f1493fce

View File

@ -62,16 +62,22 @@ void js::Mutex::preUnlockChecks() {
}
bool js::Mutex::ownedByCurrentThread() const {
// First determine this using the owningThread_ property, then check it via
// the mutex stack.
bool check = ThreadId::ThisThreadId() == owningThread_.value();
Mutex* stack = HeldMutexStack.get();
while (stack) {
if (stack == this) {
MOZ_ASSERT(check);
return true;
}
stack = stack->prev_;
}
MOZ_ASSERT(!check);
return false;
}