[rtems commit] score: Inline _User_extensions_Thread_switch()

Sebastian Huber sebh at rtems.org
Thu Nov 22 15:31:31 UTC 2012


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 22 15:00:21 2012 +0100

score: Inline _User_extensions_Thread_switch()

The _User_extensions_Thread_switch() function is only used in
_Thread_Dispatch().

---

 cpukit/score/Makefile.am                       |    3 +-
 cpukit/score/include/rtems/score/userextimpl.h |   18 +++++++++-
 cpukit/score/src/userextthreadswitch.c         |   40 ------------------------
 3 files changed, 17 insertions(+), 44 deletions(-)

diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 79d95ea..1b3d13b 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -319,8 +319,7 @@ libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c \
 
 ## USEREXT_C_FILES
 libscore_a_SOURCES += src/userextaddset.c \
-    src/userext.c src/userextremoveset.c src/userextiterate.c \
-    src/userextthreadswitch.c
+    src/userext.c src/userextremoveset.c src/userextiterate.c
 
 ## STD_C_FILES
 libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
diff --git a/cpukit/score/include/rtems/score/userextimpl.h b/cpukit/score/include/rtems/score/userextimpl.h
index 665278e..c7d35a8 100644
--- a/cpukit/score/include/rtems/score/userextimpl.h
+++ b/cpukit/score/include/rtems/score/userextimpl.h
@@ -199,10 +199,24 @@ static inline void _User_extensions_Thread_begin( Thread_Control *executing )
   );
 }
 
-void _User_extensions_Thread_switch(
+static inline void _User_extensions_Thread_switch(
   Thread_Control *executing,
   Thread_Control *heir
-);
+)
+{
+  const Chain_Control *chain = &_User_extensions_Switches_list;
+  const Chain_Node    *tail = _Chain_Immutable_tail( chain );
+  const Chain_Node    *node = _Chain_Immutable_first( chain );
+
+  while ( node != tail ) {
+    const User_extensions_Switch_control *extension =
+      (const User_extensions_Switch_control *) node;
+
+    (*extension->thread_switch)( executing, heir );
+
+    node = _Chain_Immutable_next( node );
+  }
+}
 
 static inline void _User_extensions_Thread_exitted( Thread_Control *executing )
 {
diff --git a/cpukit/score/src/userextthreadswitch.c b/cpukit/score/src/userextthreadswitch.c
deleted file mode 100644
index 43d3afe..0000000
--- a/cpukit/score/src/userextthreadswitch.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * @file
- *
- * @ingroup ScoreUserExt
- *
- * @brief User Extension Handler implementation.
- */
-
-/*
- *  COPYRIGHT (c) 1989-2007.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.com/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/score/userextimpl.h>
-
-void _User_extensions_Thread_switch (
-  Thread_Control *executing,
-  Thread_Control *heir
-)
-{
-  Chain_Node                     *the_node;
-  User_extensions_Switch_control *the_extension_switch;
-
-  for ( the_node = _Chain_First( &_User_extensions_Switches_list );
-        !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ;
-        the_node = the_node->next ) {
-
-    the_extension_switch = (User_extensions_Switch_control *) the_node;
-
-    (*the_extension_switch->thread_switch)( executing, heir );
-  }
-}




More information about the vc mailing list