Skip to content

Commit 196ef2c

Browse files
committed
bugfix: be conservative about assuming newly inserted events
Even if the wait times out there is a chance that the event queue war modified in the meantime.
1 parent d67e952 commit 196ef2c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/scheduler.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,13 @@ void Scheduler::next() { // NOLINT
297297
// point, then wait until the next tag or until a new event is
298298
// inserted asynchronously into the queue
299299
if (physical_time < t_next.time_point()) {
300-
auto status = cv_schedule_.wait_until(lock, t_next.time_point());
301-
// Start over if the event queue was modified
302-
if (status == std::cv_status::no_timeout) {
300+
cv_schedule_.wait_until(lock, t_next.time_point());
301+
// Start over if an earlier event was inserted into the event queue by a physical action
302+
if (t_next != event_queue_.begin()->first) {
303303
continue;
304304
}
305305
// update physical time and continue otherwise
306306
physical_time = t_next.time_point();
307-
reactor_assert(t_next == event_queue_.begin()->first);
308307
}
309308
}
310309

0 commit comments

Comments
 (0)