Add FetchNext to ShmEventLoop
I need this as a stop-gap until watchers work in simulation so that I
can receive every camera frame without using watchers.
Change-Id: Ic2c87fc11e69952ff8028e1484f5b236afdae70e
diff --git a/aos/events/shm-event-loop.cc b/aos/events/shm-event-loop.cc
index 781c963..a70d6f3 100644
--- a/aos/events/shm-event-loop.cc
+++ b/aos/events/shm-event-loop.cc
@@ -23,7 +23,19 @@
}
}
- bool Fetch() {
+ bool FetchNext() override {
+ const FetchValue *msg = static_cast<const FetchValue *>(
+ queue_->ReadMessageIndex(RawQueue::kNonBlock, &index_));
+ // Only update the internal pointer if we got a new message.
+ if (msg != NULL) {
+ queue_->FreeMessage(msg_);
+ msg_ = msg;
+ set_most_recent(msg_);
+ }
+ return msg != NULL;
+ }
+
+ bool Fetch() override {
static constexpr Options<RawQueue> kOptions =
RawQueue::kFromEnd | RawQueue::kNonBlock;
const FetchValue *msg = static_cast<const FetchValue *>(