[PATCH] score: Use RTEMS_SMP in _Thread_Create_idle()

Gedare Bloom gedare at rtems.org
Wed Jul 6 18:19:46 UTC 2022


ok, this changes slightly the order of events in the system state
(idle threads are now created in the preceding state,
SYSTEM_STATE_BEFORE_INITIALIZATION) but without thinking too hard
about it, I think it should be fine.

On Tue, Jul 5, 2022 at 1:06 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> 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
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list