[PATCH] score: Use RTEMS_SMP in _Thread_Create_idle()
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Jul 5 07:06:17 UTC 2022
Conditional expressions with inline functions are not optimized away if
optimization is disabled. Avoid such expressions to prevent dead
branches.
---
cpukit/score/src/threadcreateidle.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c
index 9f3c01d118..2f3b09c323 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -111,10 +111,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 ) {
@@ -124,4 +124,9 @@ void _Thread_Create_idle( void )
_Thread_Create_idle_for_CPU( cpu );
}
}
+#else
+ _Thread_Create_idle_for_CPU( _Per_CPU_Get() );
+#endif
+
+ _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
}
--
2.35.3
More information about the devel
mailing list