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/chschd.c | |
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/chschd.c')
-rw-r--r-- | src/chschd.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/chschd.c b/src/chschd.c index b6fd624e0..573b311ec 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -111,19 +111,25 @@ static void wakeup(void *p) { * the specified time has elapsed. * * @param newstate the new thread state - * @param time the number of ticks before the operation timeouts + * @param time the number of ticks before the operation timeouts. the value + * zero (\p TIME_INFINITE) is allowed. * @return The wakeup message. * @retval RDY_TIMEOUT if a timeout occurs. * @note The function must be called in the system mutex zone. * @note The function is not meant to be used in the user code directly. */ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) { - VirtualTimer vt; - chVTSetI(&vt, time, wakeup, currp); - chSchGoSleepS(newstate); - if (chVTIsArmedI(&vt)) - chVTResetI(&vt); + if (TIME_INFINITE != time) { + VirtualTimer vt; + + chVTSetI(&vt, time, wakeup, currp); + chSchGoSleepS(newstate); + if (chVTIsArmedI(&vt)) + chVTResetI(&vt); + } + else + chSchGoSleepS(newstate); return currp->p_rdymsg; } |