summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadchangepriority.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-08-02 11:26:56 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-08-03 13:57:30 +0200
commitff2e6c647d166fa54769f3c300855ef7f8020668 (patch)
tree2fe5ea9069fc561d1344e54e0524950aefd86e21 /cpukit/score/src/threadchangepriority.c
parentposix: Fix for RTEMS_DEBUG (diff)
downloadrtems-ff2e6c647d166fa54769f3c300855ef7f8020668.tar.bz2
score: Fix and simplify thread wait locks
There was a subtile race condition in _Thread_queue_Do_extract_locked(). It must first update the thread wait flags and then restore the default thread wait state. In the previous implementation this could lead under rare timing conditions to an ineffective _Thread_Wait_tranquilize() resulting to a corrupt system state. Update #2556.
Diffstat (limited to 'cpukit/score/src/threadchangepriority.c')
-rw-r--r--cpukit/score/src/threadchangepriority.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index c569530d74..97e7950693 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -46,11 +46,12 @@ static Thread_Control *_Thread_Apply_priority_locked(
* we are not REALLY changing priority.
*/
if ( ( *filter )( the_thread, &new_priority, arg ) ) {
- _Thread_queue_Context_priority_change(
- queue_context,
+ _Scheduler_Thread_set_priority( the_thread, new_priority, prepend_it );
+
+ ( *the_thread->Wait.operations->priority_change )(
+ the_thread->Wait.queue,
the_thread,
- new_priority,
- prepend_it
+ new_priority
);
} else {
the_thread = NULL;