diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-01-21 18:06:33 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-01-21 18:06:33 +0000 |
commit | ea02b6612f7f377f77cbdebe29d0d52f30e5fdeb (patch) | |
tree | 4d0a85d724aab15345eee929f15da058ce989d54 /os/kernel/src | |
parent | 6ce39015268cb3a30adc9890a312be39857e1464 (diff) | |
download | ChibiOS-ea02b6612f7f377f77cbdebe29d0d52f30e5fdeb.tar.gz ChibiOS-ea02b6612f7f377f77cbdebe29d0d52f30e5fdeb.tar.bz2 ChibiOS-ea02b6612f7f377f77cbdebe29d0d52f30e5fdeb.zip |
Condvars optimizations.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1537 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/src')
-rw-r--r-- | os/kernel/src/chcond.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/os/kernel/src/chcond.c b/os/kernel/src/chcond.c index a7ba23ed5..9e1a70cc4 100644 --- a/os/kernel/src/chcond.c +++ b/os/kernel/src/chcond.c @@ -138,19 +138,20 @@ msg_t chCondWait(CondVar *cp) { * @p chCondWaitS().
*/
msg_t chCondWaitS(CondVar *cp) {
+ Thread *ctp = currp;
Mutex *mp;
msg_t msg;
chDbgCheck(cp != NULL, "chCondWaitS");
- chDbgAssert(currp->p_mtxlist != NULL,
+ chDbgAssert(ctp->p_mtxlist != NULL,
"chCondWaitS(), #1",
"not owning a mutex");
mp = chMtxUnlockS();
- prio_insert(currp, &cp->c_queue);
- currp->p_u.wtobjp = cp;
+ prio_insert(ctp, &cp->c_queue);
+ ctp->p_u.wtobjp = cp;
chSchGoSleepS(THD_STATE_WTCOND);
- msg = currp->p_u.rdymsg;
+ msg = ctp->p_u.rdymsg;
chMtxLockS(mp);
return msg;
}
@@ -204,19 +205,20 @@ msg_t chCondWaitTimeout(CondVar *cp, systime_t time) { * @p chCondWaitTimeoutS().
*/
msg_t chCondWaitTimeoutS(CondVar *cp, systime_t time) {
+ Thread *ctp = currp;
Mutex *mp;
msg_t msg;
chDbgCheck(cp != NULL, "chCondWaitTimeoutS");
- chDbgAssert(currp->p_mtxlist != NULL,
+ chDbgAssert(ctp->p_mtxlist != NULL,
"chCondWaitTimeoutS(), #1",
"not owning a mutex");
mp = chMtxUnlockS();
- prio_insert(currp, &cp->c_queue);
- currp->p_u.wtobjp = cp;
+ prio_insert(ctp, &cp->c_queue);
+ ctp->p_u.wtobjp = cp;
chSchGoSleepTimeoutS(THD_STATE_WTCOND, time);
- msg = currp->p_u.rdymsg;
+ msg = ctp->p_u.rdymsg;
chMtxLockS(mp);
return msg;
}
|