diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-03-07 10:54:51 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-03-07 10:54:51 +0000 |
commit | 719cf5fa8d01d6660fa85708c03fcf3cdac8bf37 (patch) | |
tree | 6cdf437318c35b3971c747c962807adb1e9a6673 /src | |
parent | b7935679d5a67eb01c5254acc439cc56ce01ca29 (diff) | |
download | ChibiOS-719cf5fa8d01d6660fa85708c03fcf3cdac8bf37.tar.gz ChibiOS-719cf5fa8d01d6660fa85708c03fcf3cdac8bf37.tar.bz2 ChibiOS-719cf5fa8d01d6660fa85708c03fcf3cdac8bf37.zip |
Implemented handling for constant TIME_ZERO for timeout specifications.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@811 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src')
-rw-r--r-- | src/chschd.c | 8 | ||||
-rw-r--r-- | src/include/scheduler.h | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/chschd.c b/src/chschd.c index aad060ac9..3c17c3831 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -122,8 +122,10 @@ static void wakeup(void *p) { * to sleep is awakened after the specified time has elapsed. * * @param newstate the new thread state - * @param time the number of ticks before the operation timeouts. The value - * zero (@p TIME_INFINITE) is allowed. + * @param time the number of ticks before the operation timeouts. The + * following special values are allowed: + * - @p TIME_ZERO immediate timeout. + * - @p TIME_INFINITE no timeout. * @return The wakeup message. * @retval RDY_TIMEOUT if a timeout occurs. * @note The function must be called in the system mutex zone. @@ -131,6 +133,8 @@ static void wakeup(void *p) { */ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) { + if (TIME_ZERO == time) + return RDY_OK; if (TIME_INFINITE != time) { VirtualTimer vt; diff --git a/src/include/scheduler.h b/src/include/scheduler.h index 9b16dccc9..c79f061f7 100644 --- a/src/include/scheduler.h +++ b/src/include/scheduler.h @@ -41,9 +41,13 @@ #define HIGHPRIO 127 /**< Highest user priority.*/ #define ABSPRIO 255 /**< Greatest possible priority.*/ +/** Zero time specification for all the syscalls with a timeout + specification.*/ +#define TIME_ZERO ((systime_t)0) + /** Infinite time specification for all the syscalls with a timeout specification.*/ -#define TIME_INFINITE 0 +#define TIME_INFINITE ((systime_t)-1) /** The priority of the first thread on the given ready list. */ #define firstprio(rlp) ((rlp)->p_next->p_prio) |