summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadcreateidle.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-05 09:04:26 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-07 08:48:26 +0200
commit80090639a62b50d7d66614ca789e4592924a06e5 (patch)
treeccab61f6a2258ca30b0f32d0ae6e3bdfe4adaf0b /cpukit/score/src/threadcreateidle.c
parentscore: Conditional _Thread_Priority_replace() (diff)
downloadrtems-80090639a62b50d7d66614ca789e4592924a06e5.tar.bz2
score: Use RTEMS_SMP in _Thread_Create_idle()
Conditional expressions with inline functions are not optimized away if optimization is disabled. Avoid such expressions to prevent dead branches.
Diffstat (limited to '')
-rw-r--r--cpukit/score/src/threadcreateidle.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c
index be3cbca842..b5e0cfdc9b 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -112,10 +112,10 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control *cpu )
void _Thread_Create_idle( void )
{
+#if defined(RTEMS_SMP)
uint32_t cpu_max;
uint32_t cpu_index;
- _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
cpu_max = _SMP_Get_processor_maximum();
for ( cpu_index = 0 ; cpu_index < cpu_max ; ++cpu_index ) {
@@ -125,8 +125,12 @@ void _Thread_Create_idle( void )
_Thread_Create_idle_for_CPU( cpu );
}
}
+#else
+ _Thread_Create_idle_for_CPU( _Per_CPU_Get() );
+#endif
_CPU_Use_thread_local_storage(
&_Per_CPU_Get_executing( _Per_CPU_Get() )->Registers
);
+ _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
}