aboutsummaryrefslogtreecommitdiffstats
path: root/src/chmtx.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-07-26 09:25:11 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-07-26 09:25:11 +0000
commit69f9642bf44e6e3de680b07a22a290b9219ab47d (patch)
tree260cffa032b2d796e8bbabfa172d6c0c50ffd2b4 /src/chmtx.c
parent868866157762bc5ad7644fcaa45111ecf6ed1899 (diff)
downloadChibiOS-69f9642bf44e6e3de680b07a22a290b9219ab47d.tar.gz
ChibiOS-69f9642bf44e6e3de680b07a22a290b9219ab47d.tar.bz2
ChibiOS-69f9642bf44e6e3de680b07a22a290b9219ab47d.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@359 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chmtx.c')
-rw-r--r--src/chmtx.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/chmtx.c b/src/chmtx.c
index 2e95afca6..68e8d671b 100644
--- a/src/chmtx.c
+++ b/src/chmtx.c
@@ -95,10 +95,9 @@ void chMtxLockS(Mutex *mp) {
}
break;
}
- /*
- * Goes to sleep on the mutex.
- */
+ /* sleep on the mutex */
prio_insert(currp, &mp->m_queue);
+ /* thread remembers the mutex where it is waiting on */
currp->p_wtmtxp = mp;
chSchGoSleepS(PRWTMTX);
chDbgAssert(mp->m_owner == NULL, "chmtx.c, chMtxLockS()");
@@ -159,11 +158,10 @@ void chMtxUnlock(void) {
chDbgAssert((currp->p_mtxlist != NULL) && (currp->p_mtxlist->m_owner == currp),
"chmtx.c, chMtxUnlock()");
- /*
- * Removes the top Mutex from the owned mutexes list and marks it as not owned.
- */
+ /* remove the top Mutex from the Threads's owned mutexes list */
mp = currp->p_mtxlist;
currp->p_mtxlist = mp->m_next;
+ /* mark the Mutex as not owned */
mp->m_owner = NULL;
/*
* If a thread is waiting on the mutex then the hard part begins.