[Base] Fix wait for callback return
- If wait item has disarmed itself and is then disarmed by another thread, still wait for the callback to return to meet guaratees
This commit is contained in:
parent
3b4dc7da3b
commit
e3dd873892
|
@ -184,7 +184,9 @@ void TimerQueueWaitItem::Disarm() {
|
||||||
// once Disarm() has returned.
|
// once Disarm() has returned.
|
||||||
while (!state_.compare_exchange_weak(state, State::kDisarmed,
|
while (!state_.compare_exchange_weak(state, State::kDisarmed,
|
||||||
std::memory_order_acq_rel)) {
|
std::memory_order_acq_rel)) {
|
||||||
if (state == State::kInCallbackSelfDisarmed || state == State::kDisarmed) {
|
if (state == State::kDisarmed) {
|
||||||
|
// Do not break for kInCallbackSelfDisarmed and keep spinning in order to
|
||||||
|
// meet guarantees
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state = State::kIdle;
|
state = State::kIdle;
|
||||||
|
|
Loading…
Reference in New Issue