Only schedule OnRun callbacks right after construction in aos
OnRun is meant to be a place to do work right before the event loop
starts to run. On ShmEventLoop, this is the case, and restarting the
loop isn't all that well supported, so this doesn't make sense there
either. A lot of our tests have used this behavior since it was easy
and not disallowed.
A follow-up commit will explicitly dis-allow this behavior.
Change-Id: If50dcc0e737725129ef36cb27e07be774d96c691
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/simulated_event_loop_test.cc b/aos/events/simulated_event_loop_test.cc
index f929165..745a273 100644
--- a/aos/events/simulated_event_loop_test.cc
+++ b/aos/events/simulated_event_loop_test.cc
@@ -2635,8 +2635,6 @@
pi1->Disconnect(pi2->node());
pi2->Disconnect(pi1->node());
- std::unique_ptr<aos::EventLoop> pi1_event_loop = pi1->MakeEventLoop("sender");
-
std::unique_ptr<aos::EventLoop> pi2_event_loop =
pi2->MakeEventLoop("fetcher");
aos::Fetcher<examples::Ping> pi2_reliable_fetcher =
@@ -2645,6 +2643,8 @@
factory.RunFor(chrono::milliseconds(100));
{
+ std::unique_ptr<aos::EventLoop> pi1_event_loop =
+ pi1->MakeEventLoop("sender");
aos::Sender<examples::Ping> pi1_reliable_sender =
pi1_event_loop->MakeSender<examples::Ping>("/reliable");
FunctionScheduler run_at(pi1_event_loop.get());