[PATCH 02/12] score: Add _Scheduler_priority_Get_ready_queues()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Aug 13 13:42:47 UTC 2013


Add and use _Scheduler_priority_Get_ready_queues()
---
 .../include/rtems/score/schedulerpriorityimpl.h    |   13 +++++++++----
 cpukit/score/src/schedulerpriorityupdate.c         |    7 +++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index 7400e58..0fbece6 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -36,6 +36,12 @@ extern "C" {
  */
 /**@{**/
 
+RTEMS_INLINE_ROUTINE Chain_Control *
+_Scheduler_priority_Get_ready_queues( void )
+{
+  return ( Chain_Control * ) _Scheduler.information;
+}
+
 /**
  * @brief Ready queue initialization.
  *
@@ -52,7 +58,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize(void)
   );
 
   /* initialize ready queue structures */
-  ready_queues = (Chain_Control *) _Scheduler.information;
+  ready_queues = _Scheduler_priority_Get_ready_queues();
   for( index=0; index <= PRIORITY_MAXIMUM; index++)
     _Chain_Initialize_empty( &ready_queues[index] );
 }
@@ -181,9 +187,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(
   bool force_dispatch
 )
 {
-  Thread_Control *heir = _Scheduler_priority_Ready_queue_first(
-    (Chain_Control *) _Scheduler.information
-  );
+  Chain_Control *ready_queues = _Scheduler_priority_Get_ready_queues();
+  Thread_Control *heir = _Scheduler_priority_Ready_queue_first( ready_queues );
 
   ( void ) thread;
 
diff --git a/cpukit/score/src/schedulerpriorityupdate.c b/cpukit/score/src/schedulerpriorityupdate.c
index 1935e13..de3f026 100644
--- a/cpukit/score/src/schedulerpriorityupdate.c
+++ b/cpukit/score/src/schedulerpriorityupdate.c
@@ -27,11 +27,10 @@ void _Scheduler_priority_Update(
 {
   Scheduler_priority_Per_thread *sched_info_of_thread =
     _Scheduler_priority_Get_scheduler_info( the_thread );
-  Chain_Control                 *rq;
+  Chain_Control *ready_queues = _Scheduler_priority_Get_ready_queues();
 
-  rq                   = (Chain_Control *) _Scheduler.information;
-
-  sched_info_of_thread->ready_chain = &rq[ the_thread->current_priority ];
+  sched_info_of_thread->ready_chain =
+    &ready_queues[ the_thread->current_priority ];
 
   _Priority_bit_map_Initialize_information(
     &sched_info_of_thread->Priority_map,
-- 
1.7.7




More information about the devel mailing list