clean up the organization of + split out wpilib_interface
Change-Id: I5278e42d13c4bb46619e52e20a72e8e878863ed0
diff --git a/aos/linux_code/init.cc b/aos/linux_code/init.cc
index d7501af..a4e72db 100644
--- a/aos/linux_code/init.cc
+++ b/aos/linux_code/init.cc
@@ -109,4 +109,12 @@
SetSoftRLimit(RLIMIT_CORE, RLIM_INFINITY, true);
}
+void SetCurrentThreadRealtimePriority(int priority) {
+ struct sched_param param;
+ param.sched_priority = priority;
+ if (sched_setscheduler(0, SCHED_FIFO, ¶m) == -1) {
+ PLOG(FATAL, "sched_setscheduler(0, SCHED_FIFO, %d) failed", priority);
+ }
+}
+
} // namespace aos
diff --git a/aos/linux_code/init.h b/aos/linux_code/init.h
index 538684e..ab1aab5 100644
--- a/aos/linux_code/init.h
+++ b/aos/linux_code/init.h
@@ -25,6 +25,9 @@
// behavior without calling Init*.
void WriteCoreDumps();
+// Sets the current thread's realtime priority.
+void SetCurrentThreadRealtimePriority(int priority);
+
} // namespace aos
#endif // AOS_LINUX_CODE_INIT_H_