mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
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:
parent
8d8305ccf5
commit
17f1493fce
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user