Skip to content

Commit 6bdf8c9

Browse files
committed
ensure to always detect if a new event was inserted
1 parent e886ed7 commit 6bdf8c9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/scheduler.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ void Scheduler::next() { // NOLINT
291291
} else {
292292
// find the next tag
293293
auto t_next = event_queue_.begin()->first;
294+
log_.debug() << "try to advance logical time to tag " << t_next;
294295

295296
// synchronize with physical time if not in fast forward mode
296297
if (!environment_->fast_fwd_execution()) {
@@ -305,9 +306,12 @@ void Scheduler::next() { // NOLINT
305306
// Wait until all input actions mark the tag as safe to process.
306307
bool result{true};
307308
for (auto* action : environment_->input_actions_) {
308-
result = action->acquire_tag(t_next, lock, cv_schedule_,
309+
bool inner_result = action->acquire_tag(t_next, lock, cv_schedule_,
309310
[&t_next, this]() { return t_next != event_queue_.begin()->first; });
310-
if (!result) {
311+
// If the wait was aborted or if the next tag changed in the meantime,
312+
// we need to break from the loop and continue with the main loop.
313+
if (!inner_result || t_next != event_queue_.begin()->first) {
314+
result = false;
311315
break;
312316
}
313317
}

0 commit comments

Comments
 (0)