Update Context documentation.
Timers and PhasedLoops do something useful, so update the docs.
Change-Id: I737203ef4e6c6dc3953f21cfa11221ace67d34a4
diff --git a/aos/events/event_loop.h b/aos/events/event_loop.h
index 4f24dc0..16980dd 100644
--- a/aos/events/event_loop.h
+++ b/aos/events/event_loop.h
@@ -24,12 +24,15 @@
class EventLoop;
class WatcherState;
-// Struct available on Watchers and Fetchers with context about the current
-// message.
+// Struct available on Watchers, Fetchers, Timers, and PhasedLoops with context
+// about the current message.
struct Context {
- // Time that the message was sent.
+ // Time that the message was sent, or the timer was triggered.
monotonic_clock::time_point monotonic_sent_time;
+ // Realtime the message was sent. This is set to min_time for Timers and
+ // PhasedLoops.
realtime_clock::time_point realtime_sent_time;
+ // The rest are only valid for Watchers and Fetchers.
// Index in the queue.
uint32_t queue_index;
// Size of the data sent.
@@ -383,8 +386,7 @@
std::function<void(const Context &context, const void *message)>
watcher) = 0;
- // Returns the context for the current message.
- // TODO(austin): Fill out whatever is useful for timers.
+ // Returns the context for the current callback.
const Context &context() const { return context_; }
// Returns the configuration that this event loop was built with.
@@ -402,7 +404,7 @@
// Validates that channel exists inside configuration_ and finds its index.
int ChannelIndex(const Channel *channel);
- // Context available for watchers.
+ // Context available for watchers, timers, and phased loops.
Context context_;
friend class RawSender;