From 69f9642bf44e6e3de680b07a22a290b9219ab47d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 26 Jul 2008 09:25:11 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@359 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chmtx.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/chmtx.c') 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. -- cgit v1.2.3