From 03e8928753ef76cb747b965938092c59d6306060 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 27 Mar 2014 14:46:31 +0100 Subject: score: Delete CORE_mutex_Control::lock The holder field is enough to determine if a mutex is locked or not. This leads also to better error status codes in case a rtems_semaphore_release() is done for a mutex without having the ownership. --- cpukit/libmisc/monitor/mon-sema.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cpukit/libmisc/monitor/mon-sema.c') diff --git a/cpukit/libmisc/monitor/mon-sema.c b/cpukit/libmisc/monitor/mon-sema.c index df474eafc7..10448663d9 100644 --- a/cpukit/libmisc/monitor/mon-sema.c +++ b/cpukit/libmisc/monitor/mon-sema.c @@ -35,15 +35,17 @@ rtems_monitor_sema_canonical( rtems_sema->Core_control.semaphore.Attributes.maximum_count; } else { + /* we have a binary semaphore (mutex) */ Thread_Control *holder = rtems_sema->Core_control.mutex.holder; if (holder != NULL) { canonical_sema->holder_id = holder->Object.id; + canonical_sema->cur_count = 0; + } else { + canonical_sema->cur_count = 1; } - /* we have a binary semaphore (mutex) */ - canonical_sema->cur_count = rtems_sema->Core_control.mutex.lock; - canonical_sema->max_count = 1; /* mutex is either 0 or 1 */ + canonical_sema->max_count = 1; /* mutex is either 0 or 1 */ } } -- cgit v1.2.3