Refactor SimulatedEventLoopFactory to not have lists of functions
We can use a SimulatedEventLoop * instead of a list of std::function.
The factory is already a friend, and this lets us tell which
event loops are for which nodes much easier. This preps us for
rebooting.
Change-Id: I0fb582e76b51e2cc93b17430a41cb6e65bb0a5f1
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/event_scheduler.cc b/aos/events/event_scheduler.cc
index 3739f49..668f2b6 100644
--- a/aos/events/event_scheduler.cc
+++ b/aos/events/event_scheduler.cc
@@ -61,6 +61,13 @@
on_run_.clear();
}
+void EventScheduler::RunOnStartup() {
+ for (size_t i = 0; i < on_startup_.size(); ++i) {
+ on_startup_[i]();
+ }
+ on_startup_.clear();
+}
+
std::ostream &operator<<(std::ostream &stream,
const aos::distributed_clock::time_point &now) {
// Print it the same way we print a monotonic time. Literally.