diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-05-16 21:51:40 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-05-16 21:51:40 +0000 |
commit | d9aca5f5376cea0053c5c099111c8adc8191974e (patch) | |
tree | 8dbb8e437a8b32f4eed503e41f7b581bba17a2c8 /cpukit | |
parent | 2008-05-16 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-d9aca5f5376cea0053c5c099111c8adc8191974e.tar.bz2 |
2008-05-16 Till Straumann <strauman@slac.stanford.edu>
* score/src/threadchangepriority.c: Just in case the transient
state was set when we entered, ensure that it is still set when
we exit.
* score/src/threadclose.c: When a thread is being deleted, it should
go into the dormant state -- not the transient state.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 8 | ||||
-rw-r--r-- | cpukit/score/src/threadchangepriority.c | 38 | ||||
-rw-r--r-- | cpukit/score/src/threadclose.c | 4 |
3 files changed, 34 insertions, 16 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 9725fad435..805d11d926 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,11 @@ +2008-05-16 Till Straumann <strauman@slac.stanford.edu> + + * score/src/threadchangepriority.c: Just in case the transient + state was set when we entered, ensure that it is still set when + we exit. + * score/src/threadclose.c: When a thread is being deleted, it should + go into the dormant state -- not the transient state. + 2008-05-15 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> * libi2c/libi2c.h, libi2c/libi2c.h: added interface to query diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c index 70ec45cb51..df3ad0983f 100644 --- a/cpukit/score/src/threadchangepriority.c +++ b/cpukit/score/src/threadchangepriority.c @@ -56,7 +56,7 @@ void _Thread_Change_priority( ) { ISR_Level level; - States_Control state; + States_Control state, original_state; /* * If this is a case where prepending the task to its priority is @@ -74,6 +74,11 @@ void _Thread_Change_priority( */ /* + * Save original state + */ + original_state = the_thread->current_state; + + /* * Set a transient state for the thread so it is pulled off the Ready chains. * This will prevent it from being scheduled no matter what happens in an * ISR. @@ -95,7 +100,9 @@ void _Thread_Change_priority( */ state = the_thread->current_state; if ( state != STATES_TRANSIENT ) { - the_thread->current_state = _States_Clear( STATES_TRANSIENT, state ); + /* Only clear the transient state if it wasn't set already */ + if ( ! _States_Is_transient( original_state ) ) + the_thread->current_state = _States_Clear( STATES_TRANSIENT, state ); _ISR_Enable( level ); if ( _States_Is_waiting_on_thread_queue( state ) ) { _Thread_queue_Requeue( the_thread->Wait.queue, the_thread ); @@ -103,19 +110,22 @@ void _Thread_Change_priority( return; } - /* - * Interrupts are STILL disabled. - * We now know the thread will be in the READY state when we remove - * the TRANSIENT state. So we have to place it on the appropriate - * Ready Queue with interrupts off. - */ - the_thread->current_state = _States_Clear( STATES_TRANSIENT, state ); + /* Only clear the transient state if it wasn't set already */ + if ( ! _States_Is_transient( original_state ) ) { + /* + * Interrupts are STILL disabled. + * We now know the thread will be in the READY state when we remove + * the TRANSIENT state. So we have to place it on the appropriate + * Ready Queue with interrupts off. + */ + the_thread->current_state = _States_Clear( STATES_TRANSIENT, state ); - _Priority_Add_to_bit_map( &the_thread->Priority_map ); - if ( prepend_it ) - _Chain_Prepend_unprotected( the_thread->ready, &the_thread->Object.Node ); - else - _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node ); + _Priority_Add_to_bit_map( &the_thread->Priority_map ); + if ( prepend_it ) + _Chain_Prepend_unprotected( the_thread->ready, &the_thread->Object.Node ); + else + _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node ); + } _ISR_Flash( level ); diff --git a/cpukit/score/src/threadclose.c b/cpukit/score/src/threadclose.c index f8231a1192..a29aebdca7 100644 --- a/cpukit/score/src/threadclose.c +++ b/cpukit/score/src/threadclose.c @@ -66,10 +66,10 @@ void _Thread_Close( _Objects_Close( information, &the_thread->Object ); /* - * By setting the transient state, the thread will not be considered + * By setting the dormant state, the thread will not be considered * for scheduling when we remove any blocking states. */ - _Thread_Set_state( the_thread, STATES_TRANSIENT ); + _Thread_Set_state( the_thread, STATES_DORMANT ); if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) { if ( _Watchdog_Is_active( &the_thread->Timer ) ) |