[rtems commit] score: Convert to inline function

Sebastian Huber sebh at rtems.org
Thu Jul 18 07:54:30 UTC 2013


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jul 17 15:20:03 2013 +0200

score: Convert to inline function

---

 cpukit/score/include/rtems/score/coremuteximpl.h |   55 ++++++++++++----------
 1 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index 69be9ac..c35c0f3 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -235,31 +235,36 @@ void _CORE_mutex_Seize_interrupt_blocking(
  *  * If the caller is willing to wait
  *      then they are blocked.
  */
-#define _CORE_mutex_Seize_body( \
-  _the_mutex, _id, _wait, _timeout, _level ) \
-  do { \
-    if ( _CORE_mutex_Check_dispatch_for_seize(_wait) ) { \
-        _Internal_error_Occurred( \
-           INTERNAL_ERROR_CORE, \
-           false, \
-           INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE \
-           ); \
-    } \
-    if ( _CORE_mutex_Seize_interrupt_trylock( _the_mutex, _level ) ) {  \
-      if ( !(_wait) ) { \
-        _ISR_Enable( _level ); \
-        _Thread_Executing->Wait.return_code = \
-          CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT; \
-      } else { \
-        _Thread_queue_Enter_critical_section( &(_the_mutex)->Wait_queue ); \
-        _Thread_Executing->Wait.queue = &(_the_mutex)->Wait_queue; \
-        _Thread_Executing->Wait.id    = _id; \
-        _Thread_Disable_dispatch(); \
-        _ISR_Enable( _level ); \
-       _CORE_mutex_Seize_interrupt_blocking( _the_mutex, _timeout ); \
-      } \
-    } \
-  } while (0)
+RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize_body(
+  CORE_mutex_Control  *the_mutex,
+  Objects_Id           id,
+  bool                 wait,
+  Watchdog_Interval    timeout,
+  ISR_Level            level
+)
+{
+  if ( _CORE_mutex_Check_dispatch_for_seize( wait ) ) {
+    _Internal_error_Occurred(
+      INTERNAL_ERROR_CORE,
+      false,
+      INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE
+    );
+  }
+  if ( _CORE_mutex_Seize_interrupt_trylock( the_mutex, level ) ) {
+    if ( !wait ) {
+      _ISR_Enable( level );
+      _Thread_Executing->Wait.return_code =
+        CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT;
+    } else {
+      _Thread_queue_Enter_critical_section( &the_mutex->Wait_queue );
+      _Thread_Executing->Wait.queue = &the_mutex->Wait_queue;
+      _Thread_Executing->Wait.id = id;
+      _Thread_Disable_dispatch();
+      _ISR_Enable( level );
+      _CORE_mutex_Seize_interrupt_blocking( the_mutex, timeout );
+    }
+  }
+}
 
 /**
  *  This method is used to obtain a core mutex.




More information about the vc mailing list