[rtems commit] score: Fix CORE mutex RTEMS_MULTIPROCESSING

Sebastian Huber sebh at rtems.org
Tue Mar 29 11:42:55 UTC 2016


Module:    rtems
Branch:    master
Commit:    7a904cbe5e06a32eb7ccc7b1a28a86319df09a98
Changeset: http://git.rtems.org/rtems/commit/?id=7a904cbe5e06a32eb7ccc7b1a28a86319df09a98

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Mar 24 15:33:34 2016 +0100

score: Fix CORE mutex RTEMS_MULTIPROCESSING

Make sure that the thread proxy is registered as the mutex owner.

---

 cpukit/score/src/coremutexsurrender.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c
index 744adc5..da21d4b 100644
--- a/cpukit/score/src/coremutexsurrender.c
+++ b/cpukit/score/src/coremutexsurrender.c
@@ -187,6 +187,9 @@ CORE_mutex_Status _CORE_mutex_Surrender(
   ) {
     bool unblock;
 
+    the_mutex->holder     = the_thread;
+    the_mutex->nest_count = 1;
+
     /*
      * We must extract the thread now since this will restore its default
      * thread lock.  This is necessary to avoid a deadlock in the
@@ -205,9 +208,6 @@ CORE_mutex_Status _CORE_mutex_Surrender(
     if ( _Objects_Is_local_id( the_thread->Object.id ) )
 #endif
     {
-      the_mutex->holder     = the_thread;
-      the_mutex->nest_count = 1;
-
       switch ( the_mutex->Attributes.discipline ) {
         case CORE_MUTEX_DISCIPLINES_FIFO:
         case CORE_MUTEX_DISCIPLINES_PRIORITY:
@@ -237,12 +237,7 @@ CORE_mutex_Status _CORE_mutex_Surrender(
 
 #if defined(RTEMS_MULTIPROCESSING)
     if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
-
-      the_mutex->holder     = NULL;
-      the_mutex->nest_count = 1;
-
       ( *api_mutex_mp_support)( the_thread, id );
-
     }
 
     _Thread_Dispatch_enable( _Per_CPU_Get() );



More information about the vc mailing list