kernel: Make thread 'init_delay' k_timeout_t rather than int msecs
Storing this value in milliseconds rather than using k_timeout_t requires the system to perform division at runtime to convert types. This pulls in the 64-bit soft division code on platforms without hardware for this. Perform the conversion at build time instead by using the runtime time directly. The init_delay field was moved within the _static_thread_data structure to avoid introducing a hole for alignment on 32-bit systems when using 64-bit timeouts. Use SYS_TIMEOUT_MS instead of K_MSEC so that the initial delay can be set to forever. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
477bf558de
commit
41e8b44619
|
@ -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), \
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue