From 3547c3916175d387a43c6d3a36330550b1d278d5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 25 Oct 2008 10:35:10 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@482 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/include/threads.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/include/threads.h') 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_ */ /** @} */ -- cgit v1.2.3