summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadqflush.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-11-16 14:38:07 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-11-16 14:38:07 +0100
commit9c30c31e24069555a9e3e9ccae0d8af04fba35f5 (patch)
treefd9fffa1117f2db6f99036b29461c7a2fdfe713a /cpukit/score/src/threadqflush.c
parentrtems: rtems_semaphore_flush() with prio inherit (diff)
downloadrtems-9c30c31e24069555a9e3e9ccae0d8af04fba35f5.tar.bz2
score: Fix _Thread_queue_Flush_critical()
The thread queue extract operations performed by the _Thread_queue_Flush_critical() may result in a priority change of the thread queue owner. Carry out the scheduler priority update operation. This is especially important in SMP configurations. Close #3236.
Diffstat (limited to 'cpukit/score/src/threadqflush.c')
-rw-r--r--cpukit/score/src/threadqflush.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/cpukit/score/src/threadqflush.c b/cpukit/score/src/threadqflush.c
index 8135e67b62..ef4d6b1f09 100644
--- a/cpukit/score/src/threadqflush.c
+++ b/cpukit/score/src/threadqflush.c
@@ -66,13 +66,15 @@ size_t _Thread_queue_Flush_critical(
Thread_queue_Context *queue_context
)
{
- size_t flushed;
- Chain_Control unblock;
- Chain_Node *node;
- Chain_Node *tail;
+ size_t flushed;
+ Chain_Control unblock;
+ Thread_Control *owner;
+ Chain_Node *node;
+ Chain_Node *tail;
flushed = 0;
_Chain_Initialize_empty( &unblock );
+ owner = queue->owner;
while ( true ) {
Thread_queue_Heads *heads;
@@ -131,6 +133,14 @@ size_t _Thread_queue_Flush_critical(
node = next;
} while ( node != tail );
+ if ( owner != NULL ) {
+ ISR_lock_Context lock_context;
+
+ _Thread_State_acquire( owner, &lock_context );
+ _Scheduler_Update_priority( owner );
+ _Thread_State_release( owner, &lock_context );
+ }
+
_Thread_Dispatch_enable( cpu_self );
} else {
_Thread_queue_Queue_release( queue, &queue_context->Lock_context.Lock_context );