From 97b3035c14fd89beb7244b7c52a32581e701fbbf Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 23 Nov 2020 10:09:56 -0700 Subject: [PATCH] Kernel: Don't resume thread into Running state directly on SIGCONT We should never resume a thread by directly setting it to Running state. Instead, if a thread was in Running state when stopped, record the state as Runnable. Fixes #4150 --- Kernel/Thread.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 201e9e5446..29536a2fed 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -817,7 +817,8 @@ void Thread::set_state(State new_state) } if (new_state == Stopped) { - m_stop_state = m_state; + // We don't want to restore to Running state, only Runnable! + m_stop_state = m_state != Running ? m_state : Runnable; } m_state = new_state;