Module: xenomai-forge
Branch: next
Commit: 32fd90273ef913cbbc59775e50cf54f015db5bf5
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=32fd90273ef913cbbc59775e50cf54f015db5bf5

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Mar 28 12:12:52 2014 +0100

cobalt/rtdm: fix resource count imbalance in mutex_lock op

---

 kernel/cobalt/rtdm/drvlib.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index 17178ee..a89decc 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -1528,9 +1528,7 @@ int rtdm_mutex_timedlock(rtdm_mutex_t *mutex, 
nanosecs_rel_t timeout,
 
        if (unlikely(mutex->synch_base.status & RTDM_SYNCH_DELETED))
                err = -EIDRM;
-       else if (likely(xnsynch_owner(&mutex->synch_base) == NULL))
-               xnsynch_set_owner(&mutex->synch_base, curr_thread);
-       else {
+       else if (!xnthread_try_grab(curr_thread, &mutex->synch_base)) {
                /* Redefinition to clarify XENO_ASSERT output */
                #define mutex_owner xnsynch_owner(&mutex->synch_base)
                if (!XENO_ASSERT(RTDM, mutex_owner != curr_thread)) {


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to