[PATCH 5/5] score: Use _Thread_Clear_state() for _Thread_Ready
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Mar 31 06:00:07 UTC 2015
---
cpukit/score/Makefile.am | 2 +-
cpukit/score/include/rtems/score/statesimpl.h | 3 +++
cpukit/score/include/rtems/score/threadimpl.h | 31 ++++++++++++----------
cpukit/score/src/threadready.c | 38 ---------------------------
4 files changed, 21 insertions(+), 53 deletions(-)
delete mode 100644 cpukit/score/src/threadready.c
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 090f7f6..53b5cbf 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 fa4e434..94a19f5 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -227,37 +227,40 @@ void _Thread_Kill_zombies( void );
void _Thread_Close( Thread_Control *the_thread, Thread_Control *executing );
/**
- * @brief Removes any set states for @a the_thread.
+ * @brief Clears the indicated STATES for @a the_thread.
*
- * This routine removes any set states for @a the_thread. It performs
+ * This routine clears the indicated STATES for @a the_thread. It performs
* any necessary scheduling operations including the selection of
* a new heir thread.
*
+ * @return The previous state.
+ *
* - INTERRUPT LATENCY:
- * + ready chain
+ * + priority map
* + select heir
*/
-void _Thread_Ready(
- Thread_Control *the_thread
+States_Control _Thread_Clear_state(
+ Thread_Control *the_thread,
+ States_Control state
);
/**
- * @brief Clears the indicated STATES for @a the_thread.
+ * @brief Removes any set states for @a the_thread.
*
- * This routine clears the indicated STATES for @a the_thread. It performs
+ * This routine removes any set states for @a the_thread. It performs
* any necessary scheduling operations including the selection of
* a new heir thread.
*
- * @return The previous state.
- *
* - INTERRUPT LATENCY:
- * + priority map
+ * + ready chain
* + select heir
*/
-States_Control _Thread_Clear_state(
- Thread_Control *the_thread,
- States_Control state
-);
+RTEMS_INLINE_ROUTINE void _Thread_Ready(
+ Thread_Control *the_thread
+)
+{
+ _Thread_Clear_state( the_thread, STATES_ALL_SET );
+}
/**
* @brief Sets the indicated @a state for @a the_thread.
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