Fixed bug 3113443.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2392 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2010-11-20 10:46:51 +00:00
parent 0d717a5f9f
commit b0bdd6eff6
1 changed files with 18 additions and 6 deletions

View File

@ -382,11 +382,15 @@ eventmask_t chEvtWaitOneTimeout(eventmask_t mask, systime_t time) {
chSysLock();
if ((m = (ctp->p_epending & mask)) == 0) {
if (TIME_IMMEDIATE == time)
if (TIME_IMMEDIATE == time) {
chSysUnlock();
return (eventmask_t)0;
}
ctp->p_u.ewmask = mask;
if (chSchGoSleepTimeoutS(THD_STATE_WTOREVT, time) < RDY_OK)
if (chSchGoSleepTimeoutS(THD_STATE_WTOREVT, time) < RDY_OK) {
chSysUnlock();
return (eventmask_t)0;
}
m = ctp->p_epending & mask;
}
m &= -m;
@ -421,11 +425,15 @@ eventmask_t chEvtWaitAnyTimeout(eventmask_t mask, systime_t time) {
chSysLock();
if ((m = (ctp->p_epending & mask)) == 0) {
if (TIME_IMMEDIATE == time)
if (TIME_IMMEDIATE == time) {
chSysUnlock();
return (eventmask_t)0;
}
ctp->p_u.ewmask = mask;
if (chSchGoSleepTimeoutS(THD_STATE_WTOREVT, time) < RDY_OK)
if (chSchGoSleepTimeoutS(THD_STATE_WTOREVT, time) < RDY_OK) {
chSysUnlock();
return (eventmask_t)0;
}
m = ctp->p_epending & mask;
}
ctp->p_epending &= ~m;
@ -457,11 +465,15 @@ eventmask_t chEvtWaitAllTimeout(eventmask_t mask, systime_t time) {
chSysLock();
if ((ctp->p_epending & mask) != mask) {
if (TIME_IMMEDIATE == time)
if (TIME_IMMEDIATE == time) {
chSysUnlock();
return (eventmask_t)0;
}
ctp->p_u.ewmask = mask;
if (chSchGoSleepTimeoutS(THD_STATE_WTANDEVT, time) < RDY_OK)
if (chSchGoSleepTimeoutS(THD_STATE_WTANDEVT, time) < RDY_OK) {
chSysUnlock();
return (eventmask_t)0;
}
}
ctp->p_epending &= ~mask;