Skip to content

Commit

Permalink
fix: reset next task id during self-deregistration (#373)
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Gershman <[email protected]>
  • Loading branch information
romange authored Jan 22, 2025
1 parent 05c316e commit 4c0b156
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions util/fibers/proactor_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,20 @@ bool ProactorBase::RunOnIdleTasks() {
do {
on_idle_arr_.pop_back();
} while (!on_idle_arr_.empty() && !on_idle_arr_.back().task);
break;
on_idle_next_ = 0;
break; // do/while loop
}
} else { // level >= 0
curr_ts = GetClockNanos();

if (unsigned(level) >= kOnIdleMaxLevel) {
level = kOnIdleMaxLevel;
should_spin = true;
} else if (on_idle_next_ <
on_idle_arr_.size()) { // check if the array has not been shrunk.
uint64_t delta_ns = uint64_t(kIdleCycleMaxMicros) * 1000 / (1 << level);
on_idle.next_ts = curr_ts + delta_ns;
}
}
curr_ts = GetClockNanos();

if (unsigned(level) >= kOnIdleMaxLevel) {
level = kOnIdleMaxLevel;
should_spin = true;
} else if (on_idle_next_ < on_idle_arr_.size()) { // check if the array has not been shrunk.
uint64_t delta_ns = uint64_t(kIdleCycleMaxMicros) * 1000 / (1 << level);
on_idle.next_ts = curr_ts + delta_ns;
}
}

Expand Down

0 comments on commit 4c0b156

Please sign in to comment.