From f918966727b096fc764c637c688d0715a22b960d Mon Sep 17 00:00:00 2001 From: Drew Galbraith Date: Sat, 3 May 2025 14:54:03 -0700 Subject: [PATCH] [Zion] Don't try to set state on dying threads in cleanup. --- zion/object/thread.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zion/object/thread.cpp b/zion/object/thread.cpp index 701792c..a1a1d47 100644 --- a/zion/object/thread.cpp +++ b/zion/object/thread.cpp @@ -120,8 +120,10 @@ void Thread::Cleanup() { // 2. Unblock waiting threads. while (blocked_threads_.size() != 0) { auto thread = blocked_threads_.PopFront(); - thread->SetState(Thread::RUNNABLE); - gScheduler->Enqueue(thread); + if (!thread->IsDying()) { + thread->SetState(Thread::RUNNABLE); + gScheduler->Enqueue(thread); + } } // 3. Release Kernel Stack