Skip to content

Commit b310865

Browse files
committed
ensure that the timeout tag is released
1 parent e7bb9c1 commit b310865

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

include/reactor-cpp/scheduler.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ private:
161161
std::vector<ReleaseTagCallback> release_tag_callbacks_{};
162162
void release_current_tag();
163163

164+
void cleanup_after_tag();
165+
164166
void schedule() noexcept;
165167
auto schedule_ready_reactions() -> bool;
166168
void next();

lib/scheduler.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ void Scheduler::schedule() noexcept {
9292

9393
while (!found_ready_reactions) {
9494
if (!continue_execution_ && !found_ready_reactions) {
95-
// let all workers know that they should terminate
95+
// Cleanup and let all workers know that they should terminate.
96+
cleanup_after_tag();
9697
terminate_all_workers();
9798
break;
9899
}
@@ -306,7 +307,7 @@ void Scheduler::advance_logical_time_to(const Tag& tag) {
306307
Statistics::increment_processed_events();
307308
}
308309

309-
void Scheduler::next() { // NOLINT
310+
void Scheduler::cleanup_after_tag() {
310311
// Notify other environments and let them know that we finished processing the
311312
// current tag
312313
release_current_tag();
@@ -328,7 +329,12 @@ void Scheduler::next() { // NOLINT
328329
}
329330
vec_ports.clear();
330331
}
332+
}
331333

334+
void Scheduler::next() { // NOLINT
335+
// First, clean up after the last tag.
336+
cleanup_after_tag();
337+
332338
{
333339
std::unique_lock<std::mutex> lock{scheduling_mutex_};
334340

0 commit comments

Comments
 (0)