From 1cf32b2d7f2bb0dafce6108ecfc496491b19ad8a Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 13 Nov 2024 09:51:56 -0800 Subject: [PATCH] Fix threads stuck as zombie under M:N In this case thread_sched_switch0 never returns, so we would never end up setting finished to true. Fixes [Bug #20638] --- thread_pthread_mn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thread_pthread_mn.c b/thread_pthread_mn.c index 8508dcaf17..b5efb90f28 100644 --- a/thread_pthread_mn.c +++ b/thread_pthread_mn.c @@ -477,8 +477,8 @@ co_start(struct coroutine_context *from, struct coroutine_context *self) if (!has_ready_ractor && next_th && !next_th->nt) { // switch to the next thread thread_sched_set_lock_owner(sched, NULL); - thread_sched_switch0(th->sched.context, next_th, nt, true); th->sched.finished = true; + thread_sched_switch0(th->sched.context, next_th, nt, true); } else { // switch to the next Ractor