mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bug 1837550 - Clean up control flow in WaitableEvent. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D212642
This commit is contained in:
parent
59d854a90e
commit
e2a4fdb72f
@ -82,13 +82,14 @@ class SyncWaiter : public WaitableEvent::Waiter {
|
||||
: fired_(false), cv_(cv), lock_(lock), signaling_event_(NULL) {}
|
||||
|
||||
bool Fire(WaitableEvent* signaling_event) override {
|
||||
lock_->Acquire();
|
||||
const bool previous_value = fired_;
|
||||
fired_ = true;
|
||||
if (!previous_value) signaling_event_ = signaling_event;
|
||||
lock_->Release();
|
||||
AutoLock locked(*lock_);
|
||||
|
||||
if (previous_value) return false;
|
||||
if (fired_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fired_ = true;
|
||||
signaling_event_ = signaling_event;
|
||||
|
||||
cv_->Broadcast();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user