Commit d4429276 authored by Andy Ross's avatar Andy Ross Committed by Anas Nashif
Browse files

kernel/sched: Add missing SMP thread abort case



The loop in thread abort on SMP where we wait for the results on an
IPI correctly handled the case where a thread running on another CPU
gets its interrupt and self-aborts, but it missed the case where the
other thread pends before receiving the interrupt.

Signed-off-by: default avatarAndy Ross <andrew.j.ross@intel.com>
parent b0158cc8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1073,10 +1073,15 @@ void z_sched_abort(struct k_thread *thread)
	 */
	while ((thread->base.thread_state & _THREAD_DEAD) == 0U) {
		LOCKED(&sched_spinlock) {
			if (z_is_thread_queued(thread)) {
			if (z_is_thread_prevented_from_running(thread)) {
				__ASSERT(!z_is_thread_queued(thread), "");
				thread->base.thread_state |= _THREAD_DEAD;
			} else if (z_is_thread_queued(thread)) {
				_priq_run_remove(&_kernel.ready_q.runq, thread);
				z_mark_thread_as_not_queued(thread);
				thread->base.thread_state |= _THREAD_DEAD;
			} else {
				k_busy_wait(100);
			}
		}
	}