diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-10-26 10:45:42 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-10-26 10:45:42 +0000 |
commit | 3c4cadc596f201c3377de40a62685b3b9d7b9de1 (patch) | |
tree | 1b02fbfeb8823d24ad53a6860a070fd5e0a70bce /src/include/threads.h | |
parent | 79280551050445d86045df9e160af2f9c85b40a3 (diff) | |
download | ChibiOS-3c4cadc596f201c3377de40a62685b3b9d7b9de1.tar.gz ChibiOS-3c4cadc596f201c3377de40a62685b3b9d7b9de1.tar.bz2 ChibiOS-3c4cadc596f201c3377de40a62685b3b9d7b9de1.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@484 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/include/threads.h')
-rw-r--r-- | src/include/threads.h | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/include/threads.h b/src/include/threads.h index e9894650d..a3d37a7db 100644 --- a/src/include/threads.h +++ b/src/include/threads.h @@ -193,6 +193,7 @@ extern "C" { void chThdSuspend(Thread **tpp); void chThdTerminate(Thread *tp); void chThdSleep(systime_t time); + void chThdSleepUntil(systime_t time); void chThdExit(msg_t msg); #ifdef CH_USE_WAITEXIT msg_t chThdWait(Thread *tp); @@ -268,15 +269,28 @@ extern "C" { chThdCreateStatic(workspace, wsize, prio, pf, NULL) /** - * Suspends the invoking thread until the system time arrives to the specified - * value. + * Delays the invoking thread for the specified number of seconds. + * @note The specified time is rounded up to a value allowed by the real + * system clock. + * @note The maximum specified value is implementation dependent. */ -#define chThdSleepUntil(t) { \ - chSysLock(); \ - chSchGoSleepTimeoutS(PRSLEEP, \ - (systime_t)((t) - chSysGetTime())); \ - chSysUnlock(); \ -} +#define chThdSleepSeconds(sec) chThdSleep(S2ST(sec)) + +/** + * Delays the invoking thread for the specified number of milliseconds. + * @note The specified time is rounded up to a value allowed by the real + * system clock. + * @note The maximum specified value is implementation dependent. + */ +#define chThdSleepMilliseconds(msec) chThdSleep(MS2ST(msec)) + +/** + * Delays the invoking thread for the specified number of microseconds. + * @note The specified time is rounded up to a value allowed by the real + * system clock. + * @note The maximum specified value is implementation dependent. + */ +#define chThdSleepMicroseconds(usec) chThdSleep(US2ST(usec)) #endif /* _THREADS_H_ */ |