summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadqops.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-27 10:20:34 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-07-27 10:55:30 +0200
commitac8402ddd6e4a8eb6defb98220d39d4c20a6f025 (patch)
tree611996f2488f8b38180735dc9f51c1252bc024e5 /cpukit/score/src/threadqops.c
parentscore: Split _Thread_Change_priority() (diff)
downloadrtems-ac8402ddd6e4a8eb6defb98220d39d4c20a6f025.tar.bz2
score: Simplify _Thread_queue_Boost_priority()
Raise the priority under thread queue lock protection and omit the superfluous thread queue priority change, since the thread is extracted anyway. The unblock operation will pick up the new priority. Update #2412. Update #2556. Update #2765.
Diffstat (limited to 'cpukit/score/src/threadqops.c')
-rw-r--r--cpukit/score/src/threadqops.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c
index 5a00ee6fe1..83abf0ded0 100644
--- a/cpukit/score/src/threadqops.c
+++ b/cpukit/score/src/threadqops.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2015, 2016 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -318,16 +318,20 @@ void _Thread_queue_Boost_priority(
{
Thread_queue_Heads *heads = queue->heads;
- if (
- heads != NULL
- && (
- !_Chain_Has_only_one_node( &heads->Heads.Fifo )
- || _RBTree_Is_empty(
- &_Thread_queue_Priority_queue( heads, the_thread )->Queue
- )
- )
- ) {
- _Thread_Raise_priority( the_thread, PRIORITY_PSEUDO_ISR );
+ if ( !_Chain_Has_only_one_node( &heads->Heads.Fifo ) ) {
+ const Scheduler_Control *scheduler;
+ Scheduler_Node *own_node;
+ Priority_Control boost_priority;
+
+ the_thread->priority_restore_hint = true;
+ _Atomic_Fence( ATOMIC_ORDER_ACQ_REL );
+
+ scheduler = _Scheduler_Get_own( the_thread );
+ own_node = _Scheduler_Thread_get_own_node( the_thread );
+ boost_priority = _Scheduler_Map_priority( scheduler, PRIORITY_PSEUDO_ISR );
+ _Scheduler_Node_set_priority( own_node, boost_priority, false );
+
+ the_thread->current_priority = boost_priority;
}
}
#endif