Skip to content

Commit 6102a52

Browse files
committed
DPL: reset the async queue on STOP
1 parent f207642 commit 6102a52

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

Framework/Core/include/Framework/AsyncQueue.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ struct AsyncQueueHelpers {
5959
/// 2. then priority
6060
/// 3. only execute the highest (timeslice, debounce) value
6161
static void run(AsyncQueue& queue, TimesliceId oldestPossibleTimeslice);
62+
63+
/// Reset the queue to its initial state
64+
static void reset(AsyncQueue& queue);
6265
};
6366

6467
} // namespace o2::framework

Framework/Core/src/AsyncQueue.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,10 @@ auto AsyncQueueHelpers::run(AsyncQueue& queue, TimesliceId oldestPossible) -> vo
107107
queue.tasks.end());
108108
}
109109

110+
auto AsyncQueueHelpers::reset(AsyncQueue& queue) -> void
111+
{
112+
queue.tasks.clear();
113+
queue.iteration = 0;
114+
}
115+
110116
} // namespace o2::framework

Framework/Core/src/CommonServices.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ o2::framework::ServiceSpec CommonServices::asyncQueue()
135135
.name = "async-queue",
136136
.init = simpleServiceInit<AsyncQueue, AsyncQueue>(),
137137
.configure = noConfiguration(),
138+
.stop = [](ServiceRegistryRef services, void* service) {
139+
auto& queue = services.get<AsyncQueue>();
140+
AsyncQueueHelpers::reset(queue);
141+
},
138142
.kind = ServiceKind::Serial};
139143
}
140144

0 commit comments

Comments
 (0)