summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadqfirstpriority.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-07-07 14:26:13 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-07-15 12:43:44 -0500
commited7a02895e3bedda5edb33c91f0ffc956e9cab06 (patch)
tree0266870aab25e0eca278237aca3e11a621a12c9e /cpukit/score/src/threadqfirstpriority.c
parentrbtree: Reduce RBTree_Control size (diff)
downloadrtems-ed7a02895e3bedda5edb33c91f0ffc956e9cab06.tar.bz2
Thread Queue Priority Discipline Reimplemented with RBTree
Diffstat (limited to 'cpukit/score/src/threadqfirstpriority.c')
-rw-r--r--cpukit/score/src/threadqfirstpriority.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/cpukit/score/src/threadqfirstpriority.c b/cpukit/score/src/threadqfirstpriority.c
index 46f708e0c3..9a0bb60157 100644
--- a/cpukit/score/src/threadqfirstpriority.c
+++ b/cpukit/score/src/threadqfirstpriority.c
@@ -2,15 +2,11 @@
* @file
*
* @brief Returns Highest Priority Thread on Thread Queue
- *
* @ingroup ScoreThreadQ
*/
/*
- * Thread Queue Handler
- *
- *
- * COPYRIGHT (c) 1989-2008.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -23,21 +19,16 @@
#endif
#include <rtems/score/threadqimpl.h>
-#include <rtems/score/chainimpl.h>
+#include <rtems/score/rbtreeimpl.h>
Thread_Control *_Thread_queue_First_priority (
Thread_queue_Control *the_thread_queue
)
{
- uint32_t index;
+ RBTree_Node *first;
- for( index=0 ;
- index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ;
- index++ ) {
- if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) )
- return (Thread_Control *) _Chain_First(
- &the_thread_queue->Queues.Priority[ index ]
- );
- }
+ first = _RBTree_First( &the_thread_queue->Queues.Priority, RBT_LEFT );
+ if ( first )
+ return _RBTree_Container_of( first, Thread_Control, RBNode );
return NULL;
}