Fix sending before Run in a runtime-realtime ShmEventLoop
Any application which sends before Run is called prioritizes itself,
and then hits a CheckNotRealtime in setup for the event loop. Make
sure we don't accidentally leave the application as RT when sending
before start to avoid this (and actually prevent the inversion).
Change-Id: Ibab14e1f82fe5455600b2ae8fa6e12e992b77e82
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/shm_event_loop.cc b/aos/events/shm_event_loop.cc
index 63e1cb9..b521a33 100644
--- a/aos/events/shm_event_loop.cc
+++ b/aos/events/shm_event_loop.cc
@@ -547,7 +547,8 @@
<< ": Somebody wrote outside the buffer of their message on channel "
<< configuration::CleanedChannelToString(channel());
- wake_upper_.Wakeup(event_loop()->priority());
+ wake_upper_.Wakeup(event_loop()->is_running() ? event_loop()->priority()
+ : 0);
return true;
}
@@ -565,7 +566,8 @@
&monotonic_sent_time_, &realtime_sent_time_, &sent_queue_index_))
<< ": Somebody wrote outside the buffer of their message on channel "
<< configuration::CleanedChannelToString(channel());
- wake_upper_.Wakeup(event_loop()->priority());
+ wake_upper_.Wakeup(event_loop()->is_running() ? event_loop()->priority()
+ : 0);
// TODO(austin): Return an error if we send too fast.
return true;
}