kernel: Add halt_queue field to k_thread

The halt queue will be used to identify threads that are waiting
for a thread on another CPU to finish suspending.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
Peter Mitsis 2023-08-08 10:20:59 -04:00 committed by Anas Nashif
commit 52ae56b8a9
2 changed files with 9 additions and 0 deletions

View file

@ -351,6 +351,11 @@ struct k_thread {
struct k_obj_core obj_core;
#endif
#ifdef CONFIG_SMP
/** threads waiting in k_thread_suspend() */
_wait_q_t halt_queue;
#endif
/** arch-specifics: must always be at the end */
struct _thread_arch arch;
};

View file

@ -681,6 +681,10 @@ char *z_setup_new_thread(struct k_thread *new_thread,
#endif
new_thread->resource_pool = _current->resource_pool;
#ifdef CONFIG_SMP
z_waitq_init(&new_thread->halt_queue);
#endif
#ifdef CONFIG_SCHED_THREAD_USAGE
new_thread->base.usage = (struct k_cycle_stats) {};
new_thread->base.usage.track_usage =