Refactor location of DefaultAffinity().

Change-Id: I5fbebefb6db8fc2b65da0e4d87f5d7ed8c759918
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/BUILD b/aos/events/BUILD
index 172133e..ad3258c 100644
--- a/aos/events/BUILD
+++ b/aos/events/BUILD
@@ -115,6 +115,7 @@
         "//aos:configuration_fbs",
         "//aos:flatbuffers",
         "//aos:ftrace",
+        "//aos:realtime",
         "//aos:uuid",
         "//aos/ipc_lib:data_alignment",
         "//aos/logging:implementations",
diff --git a/aos/events/event_loop.cc b/aos/events/event_loop.cc
index 257313b..6b5b601 100644
--- a/aos/events/event_loop.cc
+++ b/aos/events/event_loop.cc
@@ -3,6 +3,7 @@
 #include "aos/configuration.h"
 #include "aos/configuration_generated.h"
 #include "aos/logging/implementations.h"
+#include "aos/realtime.h"
 #include "glog/logging.h"
 
 DEFINE_bool(timing_reports, true, "Publish timing reports.");
@@ -622,6 +623,8 @@
   context_.source_boot_uuid = boot_uuid();
 }
 
+cpu_set_t EventLoop::DefaultAffinity() { return aos::DefaultAffinity(); }
+
 void WatcherState::set_timing_report(timing::Watcher *watcher) {
   watcher_ = watcher;
   if (!watcher) {
diff --git a/aos/events/event_loop.h b/aos/events/event_loop.h
index 9ad9f4f..68b5b35 100644
--- a/aos/events/event_loop.h
+++ b/aos/events/event_loop.h
@@ -724,13 +724,7 @@
   // Defaults to 0 if this loop will not run realtime.
   virtual int runtime_realtime_priority() const = 0;
 
-  static cpu_set_t DefaultAffinity() {
-    cpu_set_t result;
-    for (int i = 0; i < CPU_SETSIZE; ++i) {
-      CPU_SET(i, &result);
-    }
-    return result;
-  }
+  static cpu_set_t DefaultAffinity();
 
   // Sets the scheduler affinity to run the event loop with. This may only be
   // called before Run().
diff --git a/aos/realtime.h b/aos/realtime.h
index 55ef5f9..caf0daa 100644
--- a/aos/realtime.h
+++ b/aos/realtime.h
@@ -38,6 +38,15 @@
   return result;
 }
 
+// Returns the affinity representing all the CPUs.
+inline cpu_set_t DefaultAffinity() {
+  cpu_set_t result;
+  for (int i = 0; i < CPU_SETSIZE; ++i) {
+    CPU_SET(i, &result);
+  }
+  return result;
+}
+
 // Returns the current thread's CPU affinity.
 cpu_set_t GetCurrentThreadAffinity();