diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-01-23 14:50:42 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-01-23 14:50:42 +0000 |
commit | 68003a03c299850f0b66adfa4df6c9d6b6ba6ab2 (patch) | |
tree | 719bb767775d1cddb05f070b32b67abfa51a37e9 /src/include/sleep.h | |
parent | 1aecb14913213565c804dda42322c6fb3136827d (diff) | |
download | ChibiOS-68003a03c299850f0b66adfa4df6c9d6b6ba6ab2.tar.gz ChibiOS-68003a03c299850f0b66adfa4df6c9d6b6ba6ab2.tar.bz2 ChibiOS-68003a03c299850f0b66adfa4df6c9d6b6ba6ab2.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@182 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/include/sleep.h')
-rw-r--r-- | src/include/sleep.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/include/sleep.h b/src/include/sleep.h index 161842a29..022b7be23 100644 --- a/src/include/sleep.h +++ b/src/include/sleep.h @@ -30,14 +30,12 @@ extern "C" { #endif
#ifdef CH_USE_SLEEP
void chThdSleep(t_time time);
-#ifdef CH_USE_SYSTEMTIME
- void chThdSleepUntil(t_time time);
-#endif /* CH_USE_SYSTEMTIME */
#endif /* CH_USE_SLEEP */
#ifdef __cplusplus
}
#endif
+#ifdef CH_USE_SYSTEMTIME
/**
* Returns the number of system ticks since the \p chSysInit() invocation.
* @return the system ticks number
@@ -48,6 +46,20 @@ extern "C" { */
#define chSysGetTime() rlist.r_stime
+/**
+ * Suspends the invoking thread until the system time arrives to the specified
+ * value.
+ * @note The function is available only if the \p CH_USE_SYSTEMTIME
+ * option is enabled in \p chconf.h.
+ */
+#define chThdSleepUntil(t) { \
+ chSysLock(); \
+ chSchGoSleepTimeoutS(PRSLEEP, \
+ (t_time)((t) - chSysGetTime())) \
+ chSysUnlock(); \
+}
+#endif /* CH_USE_SYSTEMTIME */
+
#endif /* _SLEEP_H_ */
/** @} */
|