blob: bd0c4d460fcce325cb86c3c49e398bfb178538a3 [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001#ifndef AOS_EVENTS_EVENT_LOOP_H_
2#define AOS_EVENTS_EVENT_LOOP_H_
3
4#include <atomic>
5#include <string>
James Kuszmaul3ae42262019-11-08 12:33:41 -08006#include <string_view>
Alex Perrycb7da4b2019-08-28 19:35:56 -07007
Alex Perrycb7da4b2019-08-28 19:35:56 -07008#include "aos/configuration.h"
9#include "aos/configuration_generated.h"
Austin Schuh7d87b672019-12-01 20:23:49 -080010#include "aos/events/event_loop_event.h"
Austin Schuh39788ff2019-12-01 18:22:57 -080011#include "aos/events/event_loop_generated.h"
12#include "aos/events/timing_statistics.h"
Alex Perrycb7da4b2019-08-28 19:35:56 -070013#include "aos/flatbuffers.h"
14#include "aos/json_to_flatbuffer.h"
15#include "aos/time/time.h"
Austin Schuh39788ff2019-12-01 18:22:57 -080016#include "aos/util/phased_loop.h"
Alex Perrycb7da4b2019-08-28 19:35:56 -070017#include "flatbuffers/flatbuffers.h"
18#include "glog/logging.h"
19
Austin Schuh39788ff2019-12-01 18:22:57 -080020DECLARE_bool(timing_reports);
21DECLARE_int32(timing_report_ms);
22
Alex Perrycb7da4b2019-08-28 19:35:56 -070023namespace aos {
24
Austin Schuh39788ff2019-12-01 18:22:57 -080025class EventLoop;
26class WatcherState;
27
Austin Schuh6231cc32019-12-07 13:06:15 -080028// Struct available on Watchers, Fetchers, Timers, and PhasedLoops with context
29// about the current message.
Alex Perrycb7da4b2019-08-28 19:35:56 -070030struct Context {
Austin Schuh6231cc32019-12-07 13:06:15 -080031 // Time that the message was sent, or the timer was triggered.
Alex Perrycb7da4b2019-08-28 19:35:56 -070032 monotonic_clock::time_point monotonic_sent_time;
Austin Schuh6231cc32019-12-07 13:06:15 -080033 // Realtime the message was sent. This is set to min_time for Timers and
34 // PhasedLoops.
Alex Perrycb7da4b2019-08-28 19:35:56 -070035 realtime_clock::time_point realtime_sent_time;
Austin Schuh6231cc32019-12-07 13:06:15 -080036 // The rest are only valid for Watchers and Fetchers.
Alex Perrycb7da4b2019-08-28 19:35:56 -070037 // Index in the queue.
38 uint32_t queue_index;
39 // Size of the data sent.
40 size_t size;
41 // Pointer to the data.
42 void *data;
43};
44
45// Raw version of fetcher. Contains a local variable that the fetcher will
46// update. This is used for reflection and as an interface to implement typed
47// fetchers.
48class RawFetcher {
49 public:
Austin Schuh39788ff2019-12-01 18:22:57 -080050 RawFetcher(EventLoop *event_loop, const Channel *channel);
Alex Perrycb7da4b2019-08-28 19:35:56 -070051 RawFetcher(const RawFetcher &) = delete;
52 RawFetcher &operator=(const RawFetcher &) = delete;
Austin Schuh39788ff2019-12-01 18:22:57 -080053 virtual ~RawFetcher();
Alex Perrycb7da4b2019-08-28 19:35:56 -070054
Austin Schuh39788ff2019-12-01 18:22:57 -080055 // Fetches the next message in the queue without blocking. Returns true if
56 // there was a new message and we got it.
57 bool FetchNext();
58
59 // Fetches the latest message without blocking.
60 bool Fetch();
61
62 // Returns the channel this fetcher uses.
63 const Channel *channel() const { return channel_; }
64 // Returns the context for the current message.
65 const Context &context() const { return context_; }
66
67 protected:
68 EventLoop *event_loop() { return event_loop_; }
69
Alex Perrycb7da4b2019-08-28 19:35:56 -070070 Context context_;
Austin Schuh39788ff2019-12-01 18:22:57 -080071
72 private:
73 friend class EventLoop;
74 // Implementation
75 virtual std::pair<bool, monotonic_clock::time_point> DoFetchNext() = 0;
76 virtual std::pair<bool, monotonic_clock::time_point> DoFetch() = 0;
77
78 EventLoop *event_loop_;
Austin Schuh54cf95f2019-11-29 13:14:18 -080079 const Channel *channel_;
Austin Schuh39788ff2019-12-01 18:22:57 -080080
81 internal::RawFetcherTiming timing_;
Alex Perrycb7da4b2019-08-28 19:35:56 -070082};
83
84// Raw version of sender. Sends a block of data. This is used for reflection
85// and as a building block to implement typed senders.
86class RawSender {
87 public:
Austin Schuh39788ff2019-12-01 18:22:57 -080088 RawSender(EventLoop *event_loop, const Channel *channel);
89 RawSender(const RawSender &) = delete;
90 RawSender &operator=(const RawSender &) = delete;
91
92 virtual ~RawSender();
Alex Perrycb7da4b2019-08-28 19:35:56 -070093
94 // Sends a message without copying it. The users starts by copying up to
95 // size() bytes into the data backed by data(). They then call Send to send.
96 // Returns true on a successful send.
97 virtual void *data() = 0;
98 virtual size_t size() = 0;
Austin Schuh39788ff2019-12-01 18:22:57 -080099 bool Send(size_t size);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700100
101 // Sends a single block of data by copying it.
Austin Schuh39788ff2019-12-01 18:22:57 -0800102 bool Send(const void *data, size_t size);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700103
Austin Schuh54cf95f2019-11-29 13:14:18 -0800104 const Channel *channel() const { return channel_; }
105
Alex Perrycb7da4b2019-08-28 19:35:56 -0700106 protected:
Austin Schuh39788ff2019-12-01 18:22:57 -0800107 EventLoop *event_loop() { return event_loop_; }
Austin Schuh54cf95f2019-11-29 13:14:18 -0800108
Austin Schuh39788ff2019-12-01 18:22:57 -0800109 private:
110 friend class EventLoop;
111
112 virtual bool DoSend(const void *data, size_t size) = 0;
113 virtual bool DoSend(size_t size) = 0;
114
115 EventLoop *event_loop_;
Austin Schuh54cf95f2019-11-29 13:14:18 -0800116 const Channel *channel_;
Alex Perrycb7da4b2019-08-28 19:35:56 -0700117
Austin Schuh39788ff2019-12-01 18:22:57 -0800118 internal::RawSenderTiming timing_;
119};
Alex Perrycb7da4b2019-08-28 19:35:56 -0700120
121// Fetches the newest message from a channel.
122// This provides a polling based interface for channels.
123template <typename T>
124class Fetcher {
125 public:
126 Fetcher() {}
127
128 // Fetches the next message. Returns true if it fetched a new message. This
129 // method will only return messages sent after the Fetcher was created.
130 bool FetchNext() { return fetcher_->FetchNext(); }
131
132 // Fetches the most recent message. Returns true if it fetched a new message.
133 // This will return the latest message regardless of if it was sent before or
134 // after the fetcher was created.
135 bool Fetch() { return fetcher_->Fetch(); }
136
137 // Returns a pointer to the contained flatbuffer, or nullptr if there is no
138 // available message.
139 const T *get() const {
Austin Schuh39788ff2019-12-01 18:22:57 -0800140 return fetcher_->context().data != nullptr
141 ? flatbuffers::GetRoot<T>(
142 reinterpret_cast<const char *>(fetcher_->context().data))
Alex Perrycb7da4b2019-08-28 19:35:56 -0700143 : nullptr;
144 }
145
146 // Returns the context holding timestamps and other metadata about the
147 // message.
148 const Context &context() const { return fetcher_->context(); }
149
150 const T &operator*() const { return *get(); }
151 const T *operator->() const { return get(); }
152
153 private:
154 friend class EventLoop;
155 Fetcher(::std::unique_ptr<RawFetcher> fetcher)
156 : fetcher_(::std::move(fetcher)) {}
157 ::std::unique_ptr<RawFetcher> fetcher_;
158};
159
160// Sends messages to a channel.
161template <typename T>
162class Sender {
163 public:
164 Sender() {}
165
166 // Represents a single message about to be sent to the queue.
167 // The lifecycle goes:
168 //
169 // Builder builder = sender.MakeBuilder();
170 // T::Builder t_builder = builder.MakeBuilder<T>();
171 // Populate(&t_builder);
172 // builder.Send(t_builder.Finish());
173 class Builder {
174 public:
175 Builder(RawSender *sender, void *data, size_t size)
176 : alloc_(data, size), fbb_(size, &alloc_), sender_(sender) {
177 fbb_.ForceDefaults(1);
178 }
179
180 flatbuffers::FlatBufferBuilder *fbb() { return &fbb_; }
181
182 template <typename T2>
183 typename T2::Builder MakeBuilder() {
184 return typename T2::Builder(fbb_);
185 }
186
187 bool Send(flatbuffers::Offset<T> offset) {
188 fbb_.Finish(offset);
189 return sender_->Send(fbb_.GetSize());
190 }
191
192 // CHECKs that this message was sent.
193 void CheckSent() { fbb_.Finished(); }
194
195 private:
196 PreallocatedAllocator alloc_;
197 flatbuffers::FlatBufferBuilder fbb_;
198 RawSender *sender_;
199 };
200
201 // Constructs an above builder.
202 Builder MakeBuilder();
203
Austin Schuh39788ff2019-12-01 18:22:57 -0800204 // Returns the name of the underlying queue.
Austin Schuh1e869472019-12-01 13:36:10 -0800205 const Channel *channel() const { return sender_->channel(); }
Alex Perrycb7da4b2019-08-28 19:35:56 -0700206
207 private:
208 friend class EventLoop;
209 Sender(std::unique_ptr<RawSender> sender) : sender_(std::move(sender)) {}
210 std::unique_ptr<RawSender> sender_;
211};
212
213// Interface for timers
214class TimerHandler {
215 public:
Austin Schuh39788ff2019-12-01 18:22:57 -0800216 virtual ~TimerHandler();
Alex Perrycb7da4b2019-08-28 19:35:56 -0700217
218 // Timer should sleep until base, base + offset, base + offset * 2, ...
219 // If repeat_offset isn't set, the timer only expires once.
220 virtual void Setup(monotonic_clock::time_point base,
221 monotonic_clock::duration repeat_offset =
222 ::aos::monotonic_clock::zero()) = 0;
223
224 // Stop future calls to callback().
225 virtual void Disable() = 0;
Austin Schuh1540c2f2019-11-29 21:59:29 -0800226
227 // Sets and gets the name of the timer. Set this if you want a descriptive
228 // name in the timing report.
229 void set_name(std::string_view name) { name_ = std::string(name); }
230 const std::string_view name() const { return name_; }
231
Austin Schuh39788ff2019-12-01 18:22:57 -0800232 protected:
233 TimerHandler(EventLoop *event_loop, std::function<void()> fn);
234
235 void Call(std::function<monotonic_clock::time_point()> get_time,
236 monotonic_clock::time_point event_time);
237
Austin Schuh1540c2f2019-11-29 21:59:29 -0800238 private:
Austin Schuh39788ff2019-12-01 18:22:57 -0800239 friend class EventLoop;
240
241 EventLoop *event_loop_;
242 // The function to call when Call is called.
243 std::function<void()> fn_;
Austin Schuh1540c2f2019-11-29 21:59:29 -0800244 std::string name_;
Austin Schuh39788ff2019-12-01 18:22:57 -0800245
246 internal::TimerTiming timing_;
Alex Perrycb7da4b2019-08-28 19:35:56 -0700247};
248
249// Interface for phased loops. They are built on timers.
250class PhasedLoopHandler {
251 public:
Austin Schuh39788ff2019-12-01 18:22:57 -0800252 virtual ~PhasedLoopHandler();
Alex Perrycb7da4b2019-08-28 19:35:56 -0700253
254 // Sets the interval and offset. Any changes to interval and offset only take
255 // effect when the handler finishes running.
Austin Schuh39788ff2019-12-01 18:22:57 -0800256 void set_interval_and_offset(const monotonic_clock::duration interval,
257 const monotonic_clock::duration offset) {
258 phased_loop_.set_interval_and_offset(interval, offset);
259 }
Austin Schuh1540c2f2019-11-29 21:59:29 -0800260
261 // Sets and gets the name of the timer. Set this if you want a descriptive
262 // name in the timing report.
263 void set_name(std::string_view name) { name_ = std::string(name); }
264 const std::string_view name() const { return name_; }
265
Austin Schuh39788ff2019-12-01 18:22:57 -0800266 protected:
267 void Call(std::function<monotonic_clock::time_point()> get_time,
268 std::function<void(monotonic_clock::time_point)> schedule);
269
270 PhasedLoopHandler(EventLoop *event_loop, std::function<void(int)> fn,
271 const monotonic_clock::duration interval,
272 const monotonic_clock::duration offset);
273
Austin Schuh1540c2f2019-11-29 21:59:29 -0800274 private:
Austin Schuh39788ff2019-12-01 18:22:57 -0800275 friend class EventLoop;
276
277 void Reschedule(std::function<void(monotonic_clock::time_point)> schedule,
278 monotonic_clock::time_point monotonic_now) {
279 cycles_elapsed_ += phased_loop_.Iterate(monotonic_now);
280 schedule(phased_loop_.sleep_time());
281 }
282
283 virtual void Schedule(monotonic_clock::time_point sleep_time) = 0;
284
285 EventLoop *event_loop_;
286 std::function<void(int)> fn_;
Austin Schuh1540c2f2019-11-29 21:59:29 -0800287 std::string name_;
Austin Schuh39788ff2019-12-01 18:22:57 -0800288 time::PhasedLoop phased_loop_;
289
290 int cycles_elapsed_ = 0;
291
292 internal::TimerTiming timing_;
Alex Perrycb7da4b2019-08-28 19:35:56 -0700293};
294
Alex Perrycb7da4b2019-08-28 19:35:56 -0700295class EventLoop {
296 public:
297 EventLoop(const Configuration *configuration)
Austin Schuh39788ff2019-12-01 18:22:57 -0800298 : timing_report_(flatbuffers::DetachedBuffer()),
299 configuration_(configuration) {}
Alex Perrycb7da4b2019-08-28 19:35:56 -0700300
Austin Schuh39788ff2019-12-01 18:22:57 -0800301 virtual ~EventLoop();
Alex Perrycb7da4b2019-08-28 19:35:56 -0700302
303 // Current time.
304 virtual monotonic_clock::time_point monotonic_now() = 0;
305 virtual realtime_clock::time_point realtime_now() = 0;
306
307 // Note, it is supported to create:
308 // multiple fetchers, and (one sender or one watcher) per <name, type>
309 // tuple.
310
311 // Makes a class that will always fetch the most recent value
312 // sent to the provided channel.
313 template <typename T>
James Kuszmaul3ae42262019-11-08 12:33:41 -0800314 Fetcher<T> MakeFetcher(const std::string_view channel_name) {
Austin Schuhbca6cf02019-12-22 17:28:34 -0800315 const Channel *channel =
316 configuration::GetChannel(configuration_, channel_name,
317 T::GetFullyQualifiedName(), name(), node());
Alex Perrycb7da4b2019-08-28 19:35:56 -0700318 CHECK(channel != nullptr)
319 << ": Channel { \"name\": \"" << channel_name << "\", \"type\": \""
320 << T::GetFullyQualifiedName() << "\" } not found in config.";
321
Austin Schuh217a9782019-12-21 23:02:50 -0800322 if (node() != nullptr) {
323 if (!configuration::ChannelIsReadableOnNode(channel, node())) {
324 LOG(FATAL)
325 << "Channel { \"name\": \"" << channel_name << "\", \"type\": \""
326 << T::GetFullyQualifiedName()
327 << "\" } is not able to be fetched on this node. Check your "
328 "configuration.";
329 }
330 }
331
Alex Perrycb7da4b2019-08-28 19:35:56 -0700332 return Fetcher<T>(MakeRawFetcher(channel));
333 }
334
335 // Makes class that allows constructing and sending messages to
336 // the provided channel.
337 template <typename T>
James Kuszmaul3ae42262019-11-08 12:33:41 -0800338 Sender<T> MakeSender(const std::string_view channel_name) {
Austin Schuhbca6cf02019-12-22 17:28:34 -0800339 const Channel *channel =
340 configuration::GetChannel(configuration_, channel_name,
341 T::GetFullyQualifiedName(), name(), node());
Alex Perrycb7da4b2019-08-28 19:35:56 -0700342 CHECK(channel != nullptr)
343 << ": Channel { \"name\": \"" << channel_name << "\", \"type\": \""
344 << T::GetFullyQualifiedName() << "\" } not found in config.";
345
Austin Schuh217a9782019-12-21 23:02:50 -0800346 if (node() != nullptr) {
347 if (!configuration::ChannelIsSendableOnNode(channel, node())) {
348 LOG(FATAL) << "Channel { \"name\": \"" << channel_name
349 << "\", \"type\": \"" << T::GetFullyQualifiedName()
350 << "\" } is not able to be sent on this node. Check your "
351 "configuration.";
352 }
353 }
354
Alex Perrycb7da4b2019-08-28 19:35:56 -0700355 return Sender<T>(MakeRawSender(channel));
356 }
357
358 // This will watch messages sent to the provided channel.
359 //
360 // Watch is a functor that have a call signature like so:
361 // void Event(const MessageType& type);
362 //
363 // TODO(parker): Need to support ::std::bind. For now, use lambdas.
364 // TODO(austin): Do we need a functor? Or is a std::function good enough?
365 template <typename Watch>
James Kuszmaul3ae42262019-11-08 12:33:41 -0800366 void MakeWatcher(const std::string_view name, Watch &&w);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700367
368 // The passed in function will be called when the event loop starts.
369 // Use this to run code once the thread goes into "real-time-mode",
370 virtual void OnRun(::std::function<void()> on_run) = 0;
371
Austin Schuh217a9782019-12-21 23:02:50 -0800372 // Gets the name of the event loop. This is the application name.
James Kuszmaul3ae42262019-11-08 12:33:41 -0800373 virtual const std::string_view name() const = 0;
Alex Perrycb7da4b2019-08-28 19:35:56 -0700374
Austin Schuh217a9782019-12-21 23:02:50 -0800375 // Returns the node that this event loop is running on. Returns nullptr if we
376 // are running in single-node mode.
377 virtual const Node *node() const = 0;
378
Alex Perrycb7da4b2019-08-28 19:35:56 -0700379 // Creates a timer that executes callback when the timer expires
380 // Returns a TimerHandle for configuration of the timer
381 virtual TimerHandler *AddTimer(::std::function<void()> callback) = 0;
382
383 // Creates a timer that executes callback periodically at the specified
384 // interval and offset. Returns a PhasedLoopHandler for interacting with the
385 // timer.
386 virtual PhasedLoopHandler *AddPhasedLoop(
387 ::std::function<void(int)> callback,
388 const monotonic_clock::duration interval,
389 const monotonic_clock::duration offset = ::std::chrono::seconds(0)) = 0;
390
Austin Schuh217a9782019-12-21 23:02:50 -0800391 // TODO(austin): OnExit for cleanup.
Alex Perrycb7da4b2019-08-28 19:35:56 -0700392
393 // Threadsafe.
394 bool is_running() const { return is_running_.load(); }
395
396 // Sets the scheduler priority to run the event loop at. This may not be
397 // called after we go into "real-time-mode".
398 virtual void SetRuntimeRealtimePriority(int priority) = 0;
Austin Schuh39788ff2019-12-01 18:22:57 -0800399 virtual int priority() const = 0;
Alex Perrycb7da4b2019-08-28 19:35:56 -0700400
Austin Schuh217a9782019-12-21 23:02:50 -0800401 // Fetches new messages from the provided channel (path, type).
402 //
403 // Note: this channel must be a member of the exact configuration object this
404 // was built with.
Alex Perrycb7da4b2019-08-28 19:35:56 -0700405 virtual std::unique_ptr<RawFetcher> MakeRawFetcher(
406 const Channel *channel) = 0;
407
Austin Schuh217a9782019-12-21 23:02:50 -0800408 // Watches channel (name, type) for new messages.
Alex Perrycb7da4b2019-08-28 19:35:56 -0700409 virtual void MakeRawWatcher(
410 const Channel *channel,
411 std::function<void(const Context &context, const void *message)>
412 watcher) = 0;
413
Austin Schuh217a9782019-12-21 23:02:50 -0800414 // Creates a raw sender for the provided channel. This is used for reflection
415 // based sending.
416 // Note: this ignores any node constraints. Ignore at your own peril.
417 virtual std::unique_ptr<RawSender> MakeRawSender(const Channel *channel) = 0;
418
Austin Schuh6231cc32019-12-07 13:06:15 -0800419 // Returns the context for the current callback.
Alex Perrycb7da4b2019-08-28 19:35:56 -0700420 const Context &context() const { return context_; }
421
422 // Returns the configuration that this event loop was built with.
423 const Configuration *configuration() const { return configuration_; }
424
Austin Schuh39788ff2019-12-01 18:22:57 -0800425 // Prevents the event loop from sending a timing report.
426 void SkipTimingReport() { skip_timing_report_ = true; }
427
Alex Perrycb7da4b2019-08-28 19:35:56 -0700428 protected:
Austin Schuh217a9782019-12-21 23:02:50 -0800429 // Sets the name of the event loop. This is the application name.
430 virtual void set_name(const std::string_view name) = 0;
431
Alex Perrycb7da4b2019-08-28 19:35:56 -0700432 void set_is_running(bool value) { is_running_.store(value); }
433
Austin Schuh39788ff2019-12-01 18:22:57 -0800434 // Validates that channel exists inside configuration_ and finds its index.
435 int ChannelIndex(const Channel *channel);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700436
Austin Schuh6231cc32019-12-07 13:06:15 -0800437 // Context available for watchers, timers, and phased loops.
Alex Perrycb7da4b2019-08-28 19:35:56 -0700438 Context context_;
439
Austin Schuh39788ff2019-12-01 18:22:57 -0800440 friend class RawSender;
441 friend class TimerHandler;
442 friend class RawFetcher;
443 friend class PhasedLoopHandler;
444 friend class WatcherState;
445
446 // Methods used to implement timing reports.
447 void NewSender(RawSender *sender);
448 void DeleteSender(RawSender *sender);
449 TimerHandler *NewTimer(std::unique_ptr<TimerHandler> timer);
450 PhasedLoopHandler *NewPhasedLoop(
451 std::unique_ptr<PhasedLoopHandler> phased_loop);
452 void NewFetcher(RawFetcher *fetcher);
453 void DeleteFetcher(RawFetcher *fetcher);
454 WatcherState *NewWatcher(std::unique_ptr<WatcherState> watcher);
455
456 std::vector<RawSender *> senders_;
Austin Schuh7d87b672019-12-01 20:23:49 -0800457 std::vector<RawFetcher *> fetchers_;
458
Austin Schuh39788ff2019-12-01 18:22:57 -0800459 std::vector<std::unique_ptr<TimerHandler>> timers_;
460 std::vector<std::unique_ptr<PhasedLoopHandler>> phased_loops_;
Austin Schuh39788ff2019-12-01 18:22:57 -0800461 std::vector<std::unique_ptr<WatcherState>> watchers_;
462
463 void SendTimingReport();
464 void UpdateTimingReport();
465 void MaybeScheduleTimingReports();
466
467 std::unique_ptr<RawSender> timing_report_sender_;
468
Austin Schuh7d87b672019-12-01 20:23:49 -0800469 // Tracks which event sources (timers and watchers) have data, and which
470 // don't. Added events may not change their event_time().
471 // TODO(austin): Test case 1: timer triggers at t1, handler takes until after
472 // t2 to run, t2 should then be picked up without a context switch.
473 void AddEvent(EventLoopEvent *event);
474 void RemoveEvent(EventLoopEvent *event);
475 size_t EventCount() const { return events_.size(); }
476 EventLoopEvent *PopEvent();
477 EventLoopEvent *PeekEvent() { return events_.front(); }
478 void ReserveEvents();
479
480 std::vector<EventLoopEvent *> events_;
481
Austin Schuhde8a8ff2019-11-30 15:25:36 -0800482 private:
Austin Schuh39788ff2019-12-01 18:22:57 -0800483 virtual pid_t GetTid() = 0;
484
485 FlatbufferDetachedBuffer<timing::Report> timing_report_;
486
Austin Schuhde8a8ff2019-11-30 15:25:36 -0800487 ::std::atomic<bool> is_running_{false};
488
Alex Perrycb7da4b2019-08-28 19:35:56 -0700489 const Configuration *configuration_;
Austin Schuh39788ff2019-12-01 18:22:57 -0800490
491 // If true, don't send out timing reports.
492 bool skip_timing_report_ = false;
Alex Perrycb7da4b2019-08-28 19:35:56 -0700493};
494
495} // namespace aos
496
497#include "aos/events/event_loop_tmpl.h"
498
499#endif // AOS_EVENTS_EVENT_LOOP_H