summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadchangepriority.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-08-07 21:19:55 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-08-20 10:14:02 +0200
commite5ca54c99682a264568d95d8a5db555ea8357e9c (patch)
tree8d0ab9e455831ae28229832937b6e24c243c607d /cpukit/score/src/threadchangepriority.c
parentcorrect memory model in smpatomic test case (diff)
downloadrtems-e5ca54c99682a264568d95d8a5db555ea8357e9c.tar.bz2
score: PR2136: Fix _Thread_Change_priority()
Add call to _Scheduler_Schedule() in missing path after _Thread_Set_transient() in _Thread_Change_priority(). See also sptests/spintrcritical19. Add thread parameter to _Scheduler_Schedule(). This parameter is currently unused but may be used in future SMP schedulers. Do heir selection in _Scheduler_Schedule(). Use _Scheduler_Update_heir() for this in the particular scheduler implementation. Add and use _Scheduler_Generic_block().
Diffstat (limited to 'cpukit/score/src/threadchangepriority.c')
-rw-r--r--cpukit/score/src/threadchangepriority.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index b4437313a7..b3d79844c2 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -62,6 +62,15 @@ void _Thread_Change_priority(
/* 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 );
+
+ /*
+ * The thread may have new blocking states added by interrupt service
+ * routines after the change into the transient state. This will not
+ * result in a _Scheduler_Block() operation. Make sure we select an heir
+ * now.
+ */
+ _Scheduler_Schedule( the_thread );
+
_ISR_Enable( level );
if ( _States_Is_waiting_on_thread_queue( state ) ) {
_Thread_queue_Requeue( the_thread->Wait.queue, the_thread );
@@ -91,10 +100,7 @@ void _Thread_Change_priority(
* We altered the set of thread priorities. So let's figure out
* who is the heir and if we need to switch to them.
*/
- _Scheduler_Schedule();
+ _Scheduler_Schedule( the_thread );
- if ( !_Thread_Is_executing_also_the_heir() &&
- _Thread_Executing->is_preemptible )
- _Thread_Dispatch_necessary = true;
_ISR_Enable( level );
}