[PATCH 2/3] score: Delete CORE_mutex_Control::holder_id
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Mar 27 13:49:42 UTC 2014
We can use the holder pointer to get the identifier if necessary.
---
cpukit/libmisc/monitor/mon-sema.c | 9 +++++++--
cpukit/score/include/rtems/score/coremutex.h | 2 --
cpukit/score/include/rtems/score/coremuteximpl.h | 1 -
cpukit/score/src/coremutex.c | 2 --
cpukit/score/src/coremutexsurrender.c | 5 +----
5 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/cpukit/libmisc/monitor/mon-sema.c b/cpukit/libmisc/monitor/mon-sema.c
index c8a2b16..df474ea 100644
--- a/cpukit/libmisc/monitor/mon-sema.c
+++ b/cpukit/libmisc/monitor/mon-sema.c
@@ -24,8 +24,7 @@ rtems_monitor_sema_canonical(
canonical_sema->priority_ceiling =
rtems_sema->Core_control.mutex.Attributes.priority_ceiling;
- canonical_sema->holder_id =
- rtems_sema->Core_control.mutex.holder_id;
+ canonical_sema->holder_id = 0;
if (_Attributes_Is_counting_semaphore(canonical_sema->attribute)) {
/* we have a counting semaphore */
@@ -36,6 +35,12 @@ rtems_monitor_sema_canonical(
rtems_sema->Core_control.semaphore.Attributes.maximum_count;
}
else {
+ Thread_Control *holder = rtems_sema->Core_control.mutex.holder;
+
+ if (holder != NULL) {
+ canonical_sema->holder_id = holder->Object.id;
+ }
+
/* 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 */
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h
index be11cb6..a29aee5 100644
--- a/cpukit/score/include/rtems/score/coremutex.h
+++ b/cpukit/score/include/rtems/score/coremutex.h
@@ -167,8 +167,6 @@ typedef struct {
* has not unlocked it. If the thread is not locked, there is no holder.
*/
Thread_Control *holder;
- /** This element contains the object Id of the holding thread. */
- Objects_Id holder_id;
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
/** This field is used to manipulate the priority inheritance mutex queue*/
CORE_mutex_order_list queue;
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index f2a7ca7..4978438 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -454,7 +454,6 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
if ( !_CORE_mutex_Is_locked( the_mutex ) ) {
the_mutex->lock = CORE_MUTEX_LOCKED;
the_mutex->holder = executing;
- the_mutex->holder_id = executing->Object.id;
the_mutex->nest_count = 1;
if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ){
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
index 4cdc764..1c6c3db 100644
--- a/cpukit/score/src/coremutex.c
+++ b/cpukit/score/src/coremutex.c
@@ -42,7 +42,6 @@ CORE_mutex_Status _CORE_mutex_Initialize(
if ( initial_lock == CORE_MUTEX_LOCKED ) {
the_mutex->nest_count = 1;
the_mutex->holder = executing;
- the_mutex->holder_id = executing->Object.id;
if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
@@ -60,7 +59,6 @@ CORE_mutex_Status _CORE_mutex_Initialize(
} else {
the_mutex->nest_count = 0;
the_mutex->holder = NULL;
- the_mutex->holder_id = 0;
}
_Thread_queue_Initialize(
diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c
index 11e8cd4..de1c744 100644
--- a/cpukit/score/src/coremutexsurrender.c
+++ b/cpukit/score/src/coremutexsurrender.c
@@ -172,8 +172,7 @@ CORE_mutex_Status _CORE_mutex_Surrender(
_Thread_Change_priority( holder, holder->real_priority, true );
}
}
- the_mutex->holder = NULL;
- the_mutex->holder_id = 0;
+ the_mutex->holder = NULL;
/*
* Now we check if another thread was waiting for this mutex. If so,
@@ -185,7 +184,6 @@ CORE_mutex_Status _CORE_mutex_Surrender(
if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
the_mutex->holder = NULL;
- the_mutex->holder_id = the_thread->Object.id;
the_mutex->nest_count = 1;
( *api_mutex_mp_support)( the_thread, id );
@@ -195,7 +193,6 @@ CORE_mutex_Status _CORE_mutex_Surrender(
{
the_mutex->holder = the_thread;
- the_mutex->holder_id = the_thread->Object.id;
the_mutex->nest_count = 1;
switch ( the_mutex->Attributes.discipline ) {
--
1.7.7
More information about the devel
mailing list