[rtems commit] score: _Thread_Create_idle_for_CPU()

Sebastian Huber sebh at rtems.org
Tue Jun 14 10:10:08 UTC 2016


Module:    rtems
Branch:    master
Commit:    3eda7e54930df8b3f7601ba60ff6a049b3aa45c3
Changeset: http://git.rtems.org/rtems/commit/?id=3eda7e54930df8b3f7601ba60ff6a049b3aa45c3

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jun 14 10:11:05 2016 +0200

score: _Thread_Create_idle_for_CPU()

Use priority maximum of scheduler instance.

---

 cpukit/score/src/threadcreateidle.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c
index 5608040..0df53ec 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -25,12 +25,20 @@
 #include <rtems/score/userextimpl.h>
 #include <rtems/config.h>
 
-static void _Thread_Create_idle_for_cpu( Per_CPU_Control *cpu )
+static void _Thread_Create_idle_for_CPU( Per_CPU_Control *cpu )
 {
   Objects_Name             name;
   Thread_Control          *idle;
   const Scheduler_Control *scheduler;
 
+  scheduler = _Scheduler_Get_by_CPU( cpu );
+
+#if defined(RTEMS_SMP)
+  if (scheduler == NULL) {
+    return;
+  }
+#endif
+
   name.name_u32 = _Objects_Build_name( 'I', 'D', 'L', 'E' );
 
   /*
@@ -43,11 +51,11 @@ static void _Thread_Create_idle_for_cpu( Per_CPU_Control *cpu )
   _Thread_Initialize(
     &_Thread_Internal_information,
     idle,
-    _Scheduler_Get_by_CPU( cpu ),
+    scheduler,
     NULL,        /* allocate the stack */
     _Stack_Ensure_minimum( rtems_configuration_get_idle_task_stack_size() ),
     CPU_IDLE_TASK_IS_FP,
-    PRIORITY_MAXIMUM,
+    scheduler->maximum_priority,
     true,        /* preemptable */
     THREAD_CPU_BUDGET_ALGORITHM_NONE,
     NULL,        /* no budget algorithm callout */
@@ -67,14 +75,6 @@ static void _Thread_Create_idle_for_cpu( Per_CPU_Control *cpu )
 
   _Thread_Load_environment( idle );
 
-  scheduler = _Scheduler_Get_by_CPU( cpu );
-
-#if defined(RTEMS_SMP)
-  if (scheduler == NULL) {
-    return;
-  }
-#endif
-
   idle->current_state = STATES_READY;
   _Scheduler_Start_idle( scheduler, idle, cpu );
   _User_extensions_Thread_start( idle );
@@ -91,7 +91,7 @@ void _Thread_Create_idle( void )
     Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
 
     if ( _Per_CPU_Is_processor_online( cpu ) ) {
-      _Thread_Create_idle_for_cpu( cpu );
+      _Thread_Create_idle_for_CPU( cpu );
     }
   }
 }



More information about the vc mailing list