kernel: do not queue a thread that is already queued

Do not add a thread to the run queue if it was already added.

Fixes #29244

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-10-16 20:00:17 -04:00
parent bf69afcdae
commit 081605ee23

View file

@ -417,7 +417,10 @@ static void ready_thread(struct k_thread *thread)
__ASSERT_NO_MSG(arch_mem_coherent(thread));
#endif
if (z_is_thread_ready(thread)) {
/* If thread is queued already, do not try and added it to the
* run queue again
*/
if (!z_is_thread_queued(thread) && z_is_thread_ready(thread)) {
sys_trace_thread_ready(thread);
_priq_run_add(&_kernel.ready_q.runq, thread);
z_mark_thread_as_queued(thread);