зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
8d8305ccf5
Коммит
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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче