Add set_name to event_loop.
Change-Id: I2ab1486eb8a348ceeec00ab170e2474d7fe25167
diff --git a/aos/events/shm-event-loop.cc b/aos/events/shm-event-loop.cc
index 8c0f3a2..eead9f5 100644
--- a/aos/events/shm-event-loop.cc
+++ b/aos/events/shm-event-loop.cc
@@ -181,6 +181,8 @@
// Runs the watcher callback on new messages.
void Run() {
+ ::aos::SetCurrentThreadName(thread_state_->name() + ".watcher");
+
// Signal the main thread that we are now ready.
thread_state_->MaybeSetCurrentThreadRealtimePriority();
{
@@ -396,12 +398,16 @@
on_run_.push_back(::std::move(on_run));
}
+void ShmEventLoop::set_name(const char *name) { thread_state_.name_ = name; }
+
void ShmEventLoop::Run() {
// Start all the watcher threads.
for (::std::unique_ptr<internal::WatcherThreadState> &watcher : watchers_) {
watcher->Start();
}
+ ::aos::SetCurrentThreadName(thread_state_.name());
+
// Now, all the threads are up. Go RT.
thread_state_.MaybeSetCurrentThreadRealtimePriority();
set_is_running(true);