From 0f63c8627e4b9887cef5423eff858278e1c94e16 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 10 Jun 1996 20:47:56 +0000 Subject: added code to _Thread_Clear_state to check if the state was not currently set. --- cpukit/score/src/thread.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'cpukit/score/src') diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c index 868407b3cd..5ca29b27b9 100644 --- a/cpukit/score/src/thread.c +++ b/cpukit/score/src/thread.c @@ -718,32 +718,38 @@ void _Thread_Ready( * select heir */ + void _Thread_Clear_state( Thread_Control *the_thread, States_Control state ) { - ISR_Level level; + ISR_Level level; + States_Control current_state; _ISR_Disable( level ); - the_thread->current_state = - _States_Clear( state, the_thread->current_state ); + current_state = the_thread->current_state; + + if ( current_state & state ) { + current_state = + the_thread->current_state = _States_Clear( state, current_state ); - if ( _States_Is_ready( the_thread->current_state ) ) { + if ( _States_Is_ready( current_state ) ) { - _Priority_Add_to_bit_map( &the_thread->Priority_map ); + _Priority_Add_to_bit_map( &the_thread->Priority_map ); - _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node ); + _Chain_Append_unprotected(the_thread->ready, &the_thread->Object.Node); - _ISR_Flash( level ); + _ISR_Flash( level ); - if ( the_thread->current_priority < _Thread_Heir->current_priority ) { - _Thread_Heir = the_thread; - if ( _Thread_Executing->is_preemptible || - the_thread->current_priority == 0 ) - _Context_Switch_necessary = TRUE; + if ( the_thread->current_priority < _Thread_Heir->current_priority ) { + _Thread_Heir = the_thread; + if ( _Thread_Executing->is_preemptible || + the_thread->current_priority == 0 ) + _Context_Switch_necessary = TRUE; + } } - } + } _ISR_Enable( level ); } -- cgit v1.2.3