score: Use _Thread_Clear_state() for _Thread_Ready

This commit is contained in:
Sebastian Huber
2015-03-27 21:13:29 +01:00
parent edcf89b6f2
commit 1461aba8da
4 changed files with 19 additions and 54 deletions

View File

@@ -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 \

View File

@@ -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.

View File

@@ -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.
*

View File

@@ -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 );
}