aboutsummaryrefslogtreecommitdiffstats
path: root/src/chmtx.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-12-20 15:40:12 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-12-20 15:40:12 +0000
commitb4f7d8edfe03b6205caaf887faed663fd2222ec5 (patch)
treee45f451d5ad4431effb4b72630e2bb83a592108a /src/chmtx.c
parentc69790a0f323c27ee365e8745d60e4cfbca103c2 (diff)
downloadChibiOS-b4f7d8edfe03b6205caaf887faed663fd2222ec5.tar.gz
ChibiOS-b4f7d8edfe03b6205caaf887faed663fd2222ec5.tar.bz2
ChibiOS-b4f7d8edfe03b6205caaf887faed663fd2222ec5.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@152 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chmtx.c')
-rw-r--r--src/chmtx.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/chmtx.c b/src/chmtx.c
index 6f53a615f..822789270 100644
--- a/src/chmtx.c
+++ b/src/chmtx.c
@@ -189,8 +189,15 @@ void chMtxUnlockS(void) {
newprio = mp->m_queue.p_next->p_prio;
mp = mp->m_next;
}
- currp->p_prio = newprio;
- chSchWakeupS(tp, RDY_OK);
+ if (currp->p_prio == newprio)
+ chSchWakeupS(tp, RDY_OK);
+ else {
+ /* Note, changing priority and use chSchWakeupS() is wrong because the
+ internal optimization, see the chSchWakeupS() notes.*/
+ currp->p_prio = newprio;
+ chSchReadyI(tp, RDY_OK);
+ chSchRescheduleS();
+ }
}
}