diff --git a/include/zephyr/kernel.h b/include/zephyr/kernel.h index 0ab33e85d42..e3c467f1dbc 100644 --- a/include/zephyr/kernel.h +++ b/include/zephyr/kernel.h @@ -686,8 +686,8 @@ struct _static_thread_data { void *init_p3; int init_prio; uint32_t init_options; - int32_t init_delay; const char *init_name; + k_timeout_t init_delay; }; #define Z_THREAD_INITIALIZER(thread, stack, stack_size, \ @@ -703,7 +703,7 @@ struct _static_thread_data { .init_p3 = (void *)p3, \ .init_prio = (prio), \ .init_options = (options), \ - .init_delay = (delay), \ + .init_delay = SYS_TIMEOUT_MS(delay), \ .init_name = STRINGIFY(tname), \ } diff --git a/kernel/thread.c b/kernel/thread.c index 49b97e6cb4b..2b0b5ce0aac 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -790,9 +790,9 @@ void z_init_static_threads(void) */ k_sched_lock(); _FOREACH_STATIC_THREAD(thread_data) { - if (thread_data->init_delay != K_TICKS_FOREVER) { + if (!K_TIMEOUT_EQ(thread_data->init_delay, K_FOREVER)) { schedule_new_thread(thread_data->init_thread, - K_MSEC(thread_data->init_delay)); + thread_data->init_delay); } } k_sched_unlock();