From 1461aba8da79b7e37d789b2bd6032e09d7f888c2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 27 Mar 2015 21:13:29 +0100 Subject: score: Use _Thread_Clear_state() for _Thread_Ready --- 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 (limited to 'cpukit') diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index 112f7e80a1..dc51e9a691 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 4251b3c84d..074b3528e3 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 0f37655e0c..a13a0decc1 100644 --- a/cpukit/score/include/rtems/score/threadimpl.h +++ b/cpukit/score/include/rtems/score/threadimpl.h @@ -226,21 +226,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. * @@ -273,6 +258,21 @@ States_Control _Thread_Set_state( States_Control 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. * diff --git a/cpukit/score/src/threadready.c b/cpukit/score/src/threadready.c deleted file mode 100644 index 5375294fe9..0000000000 --- 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 -#include -#include - -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 ); -} -- cgit v1.2.3