[rtems commit] score: Modify _Thread_Dispatch_disable_critical()

Sebastian Huber sebh at rtems.org
Tue Apr 21 06:26:21 UTC 2015


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Apr 20 09:49:39 2015 +0200

score: Modify _Thread_Dispatch_disable_critical()

Return the current processor to be in line with
_Thread_Disable_dispatch().

---

 cpukit/score/include/rtems/score/objectimpl.h     |  4 ++--
 cpukit/score/include/rtems/score/threaddispatch.h | 16 +++++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index a96dc20..cf14c2d 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -674,9 +674,9 @@ _Objects_Release_and_thread_dispatch_disable(
   ISR_lock_Context *lock_context
 )
 {
-  Per_CPU_Control *cpu_self = _Per_CPU_Get();
+  Per_CPU_Control *cpu_self;
 
-  _Thread_Dispatch_disable_critical( cpu_self );
+  cpu_self = _Thread_Dispatch_disable_critical();
   _Objects_Release_and_ISR_enable( the_object, lock_context );
 
   return cpu_self;
diff --git a/cpukit/score/include/rtems/score/threaddispatch.h b/cpukit/score/include/rtems/score/threaddispatch.h
index f8c3611..89f5c0b 100644
--- a/cpukit/score/include/rtems/score/threaddispatch.h
+++ b/cpukit/score/include/rtems/score/threaddispatch.h
@@ -242,16 +242,19 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level );
  *
  * This function does not acquire the Giant lock.
  *
- * @param[in] cpu_self The current processor.
+ * @return The current processor.
  */
-RTEMS_INLINE_ROUTINE void _Thread_Dispatch_disable_critical(
-  Per_CPU_Control *cpu_self
-)
+RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable_critical( void )
 {
-  uint32_t disable_level = cpu_self->thread_dispatch_disable_level;
+  Per_CPU_Control *cpu_self;
+  uint32_t         disable_level;
 
+  cpu_self = _Per_CPU_Get();
+  disable_level = cpu_self->thread_dispatch_disable_level;
   _Profiling_Thread_dispatch_disable( cpu_self, disable_level );
   cpu_self->thread_dispatch_disable_level = disable_level + 1;
+
+  return cpu_self;
 }
 
 /**
@@ -271,8 +274,7 @@ RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable( void )
   _ISR_Disable_without_giant( level );
 #endif
 
-  cpu_self = _Per_CPU_Get();
-  _Thread_Dispatch_disable_critical( cpu_self );
+  cpu_self = _Thread_Dispatch_disable_critical();
 
 #if defined( RTEMS_SMP ) || defined( RTEMS_PROFILING )
   _ISR_Enable_without_giant( level );



More information about the vc mailing list