[PATCH 4/4 v2] score: Use _Thread_Clear_state() for _Thread_Ready

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Apr 8 09:49:12 UTC 2015


---
 cpukit/score/Makefile.am                      |  2 +-
 cpukit/score/include/rtems/score/statesimpl.h |  3 +++
 cpukit/score/include/rtems/score/threadimpl.h | 30 ++++++++++-----------
 cpukit/score/src/threadready.c                | 38 ---------------------------
 4 files changed, 19 insertions(+), 54 deletions(-)
 delete mode 100644 cpukit/score/src/threadready.c

diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 112f7e8..dc51e9a 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -284,7 +284,7 @@ libscore_a_SOURCES += src/thread.c src/threadchangepriority.c \
     src/threaddelayended.c src/threaddispatch.c \
     src/threadenabledispatch.c src/threaddisabledispatch.c \
     src/threadget.c src/threadhandler.c src/threadinitialize.c \
-    src/threadloadenv.c src/threadready.c \
+    src/threadloadenv.c \
     src/threadrestart.c src/threadsetpriority.c \
     src/threadsetstate.c \
     src/threadstackallocate.c src/threadstackfree.c src/threadstart.c \
diff --git a/cpukit/score/include/rtems/score/statesimpl.h b/cpukit/score/include/rtems/score/statesimpl.h
index 4251b3c..074b352 100644
--- a/cpukit/score/include/rtems/score/statesimpl.h
+++ b/cpukit/score/include/rtems/score/statesimpl.h
@@ -118,6 +118,9 @@ extern "C" {
                                  STATES_WAITING_ON_THREAD_QUEUE | \
                                  STATES_INTERRUPTIBLE_BY_SIGNAL )
 
+/** All state bits set to one (provided for _Thread_Ready()) */
+#define STATES_ALL_SET 0xffffffff
+
 /**
  * This function sets the given states_to_set into the current_state
  * passed in.  The result is returned to the user in current_state.
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 0f37655..a13a0de 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -227,21 +227,6 @@ void _Thread_Kill_zombies( void );
 void _Thread_Close( Thread_Control *the_thread, Thread_Control *executing );
 
 /**
- *  @brief Removes any set states for @a the_thread.
- *
- *  This routine removes any set states for @a the_thread.  It performs
- *  any necessary scheduling operations including the selection of
- *  a new heir thread.
- *
- *  - INTERRUPT LATENCY:
- *    + ready chain
- *    + select heir
- */
-void _Thread_Ready(
-  Thread_Control *the_thread
-);
-
-/**
  * @brief Clears the specified thread state.
  *
  * In case the previous state is a non-ready state and the next state is the
@@ -274,6 +259,21 @@ States_Control _Thread_Set_state(
 );
 
 /**
+ * @brief Clears all thread states.
+ *
+ * In case the previous state is a non-ready state, then the thread is
+ * unblocked by the scheduler.
+ *
+ * @param[in] the_thread The thread.
+ */
+RTEMS_INLINE_ROUTINE void _Thread_Ready(
+  Thread_Control *the_thread
+)
+{
+  _Thread_Clear_state( the_thread, STATES_ALL_SET );
+}
+
+/**
  *  @brief Initializes enviroment for a thread.
  *
  *  This routine initializes the context of @a the_thread to its
diff --git a/cpukit/score/src/threadready.c b/cpukit/score/src/threadready.c
deleted file mode 100644
index 5375294..0000000
--- a/cpukit/score/src/threadready.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *  @file
- *
- *  @brief Thread Ready
- *  @ingroup ScoreThread
- */
-
-/*
- *  COPYRIGHT (c) 1989-2011.
- *  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.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/isrlevel.h>
-#include <rtems/score/schedulerimpl.h>
-
-void _Thread_Ready(
-  Thread_Control *the_thread
-)
-{
-  ISR_lock_Context lock_context;
-
-  _Scheduler_Acquire( the_thread, &lock_context );
-
-  the_thread->current_state = STATES_READY;
-
-  _Scheduler_Unblock( the_thread );
-
-  _Scheduler_Release( the_thread, &lock_context );
-}
-- 
1.8.4.5




More information about the devel mailing list