diff --git a/kernel/init.c b/kernel/init.c index e2900e6b28a..bfbebea3d61 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -310,14 +310,14 @@ void __weak main(void) #if defined(CONFIG_MULTITHREADING) static void init_idle_thread(struct k_thread *thr, k_thread_stack_t *stack) { -#ifdef CONFIG_SMP - thr->base.is_idle = 1U; -#endif - z_setup_new_thread(thr, stack, IDLE_STACK_SIZE, idle, NULL, NULL, NULL, K_LOWEST_THREAD_PRIO, K_ESSENTIAL, IDLE_THREAD_NAME); z_mark_thread_as_started(thr); + +#ifdef CONFIG_SMP + thr->base.is_idle = 1U; +#endif } #endif /* CONFIG_MULTITHREADING */ diff --git a/kernel/pipes.c b/kernel/pipes.c index 83a1c5b1461..e48fa9b1450 100644 --- a/kernel/pipes.c +++ b/kernel/pipes.c @@ -767,6 +767,9 @@ void k_pipe_block_put(struct k_pipe *pipe, struct k_mem_block *block, async_desc->desc.copy_block = *block; async_desc->desc.sem = sem; async_desc->thread.prio = k_thread_priority_get(_current); +#ifdef CONFIG_SMP + async_desc->thread.is_idle = 0; +#endif (void) z_pipe_put_internal(pipe, async_desc, block->data, bytes_to_write, &dummy_bytes_written, diff --git a/kernel/thread.c b/kernel/thread.c index b0a2bca138a..b6b8a70969c 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -775,6 +775,10 @@ void z_init_thread_base(struct _thread_base *thread_base, int priority, thread_base->sched_locked = 0U; +#ifdef CONFIG_SMP + thread_base->is_idle = 0; +#endif + /* swap_data does not need to be initialized */ z_init_thread_timeout(thread_base);