Explicit instantiation of a function template
Fixed annoying clang-tidy warning
Change-Id: I2a25aab6120aecf704f08d569ecc8cf632dea039
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/time/time.cc b/aos/time/time.cc
index fe8422b..0e02481 100644
--- a/aos/time/time.cc
+++ b/aos/time/time.cc
@@ -51,8 +51,8 @@
#ifdef __linux__
-namespace std::this_thread {
-template <>
+namespace aos::this_thread {
+
void sleep_until(const ::aos::monotonic_clock::time_point &end_time) {
struct timespec end_time_timespec;
::std::chrono::seconds sec =
@@ -73,7 +73,7 @@
} while (returnval != 0);
}
-} // namespace std::this_thread
+} // namespace aos::this_thread
#endif // __linux__
diff --git a/aos/time/time.h b/aos/time/time.h
index f0b3a06..5481bd6 100644
--- a/aos/time/time.h
+++ b/aos/time/time.h
@@ -121,13 +121,17 @@
#ifdef __linux__
-namespace std::this_thread {
+namespace aos::this_thread {
+void sleep_until(const ::aos::monotonic_clock::time_point &end_time);
+} // namespace aos::this_thread
+
// Template specialization for monotonic_clock, since we can use clock_nanosleep
// with TIMER_ABSTIME and get very precise absolute time sleeps.
template <>
-void sleep_until(const ::aos::monotonic_clock::time_point &end_time);
-
-} // namespace std::this_thread
+inline void std::this_thread::sleep_until(
+ const ::aos::monotonic_clock::time_point &end_time) {
+ ::aos::this_thread::sleep_until(end_time);
+}
#endif // __linux__