mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Clean up control flow in WaitableEvent.
This commit is contained in:
parent
9759098329
commit
68639a9347
1 changed files with 7 additions and 8 deletions
|
|
@ -90,15 +90,14 @@ class SyncWaiter : public WaitableEvent::Waiter {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Fire(WaitableEvent *signaling_event) {
|
bool Fire(WaitableEvent *signaling_event) {
|
||||||
lock_->Acquire();
|
AutoLock locked(*lock_);
|
||||||
const bool previous_value = fired_;
|
|
||||||
fired_ = true;
|
|
||||||
if (!previous_value)
|
|
||||||
signaling_event_ = signaling_event;
|
|
||||||
lock_->Release();
|
|
||||||
|
|
||||||
if (previous_value)
|
if (fired_) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fired_ = true;
|
||||||
|
signaling_event_ = signaling_event;
|
||||||
|
|
||||||
cv_->Broadcast();
|
cv_->Broadcast();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue