aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/src/chevents.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-20 10:46:51 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-20 10:46:51 +0000
commitb0bdd6eff685c2d678a052ebb1a0e9fa5512aaac (patch)
treec5095c501e475e2e35eee9f4d918774ea671b0d5 /os/kernel/src/chevents.c
parent0d717a5f9fe78ad4857677baf9d0000c2304a6ca (diff)
downloadChibiOS-b0bdd6eff685c2d678a052ebb1a0e9fa5512aaac.tar.gz
ChibiOS-b0bdd6eff685c2d678a052ebb1a0e9fa5512aaac.tar.bz2
ChibiOS-b0bdd6eff685c2d678a052ebb1a0e9fa5512aaac.zip
Fixed bug 3113443.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2392 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/src/chevents.c')
-rw-r--r--os/kernel/src/chevents.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/os/kernel/src/chevents.c b/os/kernel/src/chevents.c
index a66a7fa28..a0ef2d1bb 100644
--- a/os/kernel/src/chevents.c
+++ b/os/kernel/src/chevents.c
@@ -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;