aboutsummaryrefslogtreecommitdiffstats
path: root/src/chthreads.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chthreads.c')
-rw-r--r--src/chthreads.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/chthreads.c b/src/chthreads.c
index 11d2442ad..3f55c4de5 100644
--- a/src/chthreads.c
+++ b/src/chthreads.c
@@ -289,7 +289,7 @@ void chThdTerminate(Thread *tp) {
/**
* Suspends the invoking thread for the specified time.
- * @param time the system ticks number
+ * @param time the delay in system ticks
*/
void chThdSleep(systime_t time) {
@@ -299,6 +299,19 @@ void chThdSleep(systime_t time) {
}
/**
+ * Suspends the invoking thread until the system time arrives to the specified
+ * value.
+ * @param time the absolute system time
+ */
+void chThdSleepUntil(systime_t time) {
+
+ chSysLock();
+ if ((time -= chSysGetTime()) > 0)
+ chSchGoSleepTimeoutS(PRSLEEP, time);
+ chSysUnlock();
+}
+
+/**
* Terminates the current thread by specifying an exit status code.
*
* @param msg the thread exit code. The code can be retrieved by using