aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/threads.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/threads.h')
-rw-r--r--src/include/threads.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/include/threads.h b/src/include/threads.h
index 051ca482d..e9894650d 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -189,10 +189,11 @@ extern "C" {
Thread *chThdCreate(tprio_t prio, tmode_t mode, void *workspace,
size_t wsize, tfunc_t pf, void *arg);
void chThdSetPriority(tprio_t newprio);
- void chThdExit(msg_t msg);
Thread *chThdResume(Thread *tp);
void chThdSuspend(Thread **tpp);
void chThdTerminate(Thread *tp);
+ void chThdSleep(systime_t time);
+ void chThdExit(msg_t msg);
#ifdef CH_USE_WAITEXIT
msg_t chThdWait(Thread *tp);
#endif
@@ -266,6 +267,17 @@ extern "C" {
#define chThdCreateFast(prio, workspace, wsize, pf) \
chThdCreateStatic(workspace, wsize, prio, pf, NULL)
+/**
+ * Suspends the invoking thread until the system time arrives to the specified
+ * value.
+ */
+#define chThdSleepUntil(t) { \
+ chSysLock(); \
+ chSchGoSleepTimeoutS(PRSLEEP, \
+ (systime_t)((t) - chSysGetTime())); \
+ chSysUnlock(); \
+}
+
#endif /* _THREADS_H_ */
/** @} */