[rtems commit] score: _CORE_mutex_Seize_interrupt_blocking()

Sebastian Huber sebh at rtems.org
Thu Apr 23 09:10:19 UTC 2015


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Apr 23 10:27:07 2015 +0200

score: _CORE_mutex_Seize_interrupt_blocking()

Move some code into _CORE_mutex_Seize_interrupt_blocking() so that the
thread queue handling is in one place.

---

 cpukit/score/include/rtems/score/coremuteximpl.h | 15 +++++++++------
 cpukit/score/src/coremutexseize.c                |  7 ++++++-
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index e1478dd..e019b0a 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -187,11 +187,13 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
  *  @param[in,out] the_mutex is the mutex to attempt to lock
  *  @param[in,out] executing The currently executing thread.
  *  @param[in] timeout is the maximum number of ticks to block
+ *  @param[in] lock_context is the interrupt level
  */
 void _CORE_mutex_Seize_interrupt_blocking(
   CORE_mutex_Control  *the_mutex,
   Thread_Control      *executing,
-  Watchdog_Interval    timeout
+  Watchdog_Interval    timeout,
+  ISR_lock_Context    *lock_context
 );
 
 /**
@@ -264,12 +266,13 @@ RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize_body(
       executing->Wait.return_code =
         CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT;
     } else {
-      _Thread_queue_Enter_critical_section( &the_mutex->Wait_queue );
-      executing->Wait.queue = &the_mutex->Wait_queue;
       executing->Wait.id = id;
-      _Thread_Disable_dispatch();
-      _ISR_lock_ISR_enable( lock_context );
-      _CORE_mutex_Seize_interrupt_blocking( the_mutex, executing, timeout );
+      _CORE_mutex_Seize_interrupt_blocking(
+        the_mutex,
+        executing,
+        timeout,
+        lock_context
+      );
     }
   }
 }
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
index d49b566..3fc3765 100644
--- a/cpukit/score/src/coremutexseize.c
+++ b/cpukit/score/src/coremutexseize.c
@@ -49,9 +49,14 @@ void _CORE_mutex_Seize(
 void _CORE_mutex_Seize_interrupt_blocking(
   CORE_mutex_Control  *the_mutex,
   Thread_Control      *executing,
-  Watchdog_Interval    timeout
+  Watchdog_Interval    timeout,
+  ISR_lock_Context    *lock_context
 )
 {
+  _Thread_queue_Enter_critical_section( &the_mutex->Wait_queue );
+  executing->Wait.queue = &the_mutex->Wait_queue;
+  _Thread_Disable_dispatch();
+  _ISR_lock_ISR_enable( lock_context );
 
   if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
     Thread_Control *holder = the_mutex->holder;



More information about the vc mailing list