diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-06-10 20:47:56 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-06-10 20:47:56 +0000 |
commit | 0f63c8627e4b9887cef5423eff858278e1c94e16 (patch) | |
tree | 94a55f1f3e8b75380d1ea4944b891066a0b8745e /cpukit/score/src | |
parent | first attempt at the routine which vectors signals. (diff) | |
download | rtems-0f63c8627e4b9887cef5423eff858278e1c94e16.tar.bz2 |
added code to _Thread_Clear_state to check if the state was not currently set.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/thread.c | 32 |
1 files changed, 19 insertions, 13 deletions
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 ); } |