diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-19 17:03:31 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 16:11:02 +0200 |
commit | 8a040fe4eeb9f7ba5c9f95f8abd45b9b6d5f7c4b (patch) | |
tree | 9eae69fdf0cbda0635d6f2c9e13c04a50dab0742 /cpukit/score/src/threadqops.c | |
parent | 7dfb4b970cbd22cef170b2f45a41f445406a2ce5 (diff) |
score: Use _RBTree_Insert_inline()
Use _RBTree_Insert_inline() for priority thread queues.
Update #2556.
Diffstat (limited to 'cpukit/score/src/threadqops.c')
-rw-r--r-- | cpukit/score/src/threadqops.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c index 5a82aaa33e..c3221b94b6 100644 --- a/cpukit/score/src/threadqops.c +++ b/cpukit/score/src/threadqops.c @@ -167,6 +167,20 @@ static Thread_queue_Priority_queue *_Thread_queue_Priority_queue( #endif } +static bool _Thread_queue_Priority_less( + const void *left, + const RBTree_Node *right +) +{ + const Priority_Control *the_left; + const Thread_Control *the_right; + + the_left = left; + the_right = THREAD_RBTREE_NODE_TO_THREAD( right ); + + return *the_left < the_right->current_priority; +} + static void _Thread_queue_Priority_priority_change( Thread_Control *the_thread, Priority_Control new_priority, @@ -184,11 +198,11 @@ static void _Thread_queue_Priority_priority_change( &priority_queue->Queue, &the_thread->Wait.Node.RBTree ); - _RBTree_Insert( + _RBTree_Insert_inline( &priority_queue->Queue, &the_thread->Wait.Node.RBTree, - _Thread_queue_Compare_priority, - false + &new_priority, + _Thread_queue_Priority_less ); } @@ -210,6 +224,7 @@ static void _Thread_queue_Priority_do_enqueue( { Thread_queue_Priority_queue *priority_queue = _Thread_queue_Priority_queue( heads, the_thread ); + Priority_Control current_priority; #if defined(RTEMS_SMP) if ( _RBTree_Is_empty( &priority_queue->Queue ) ) { @@ -217,11 +232,12 @@ static void _Thread_queue_Priority_do_enqueue( } #endif - _RBTree_Insert( + current_priority = the_thread->current_priority; + _RBTree_Insert_inline( &priority_queue->Queue, &the_thread->Wait.Node.RBTree, - _Thread_queue_Compare_priority, - false + ¤t_priority, + _Thread_queue_Priority_less ); } |