summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorPeter Nelson <peter@peterdn.com>2020-04-11 22:39:46 +0100
committerGitHub <noreply@github.com>2020-04-11 23:39:46 +0200
commiteff27f39d595a7e90b230d2580a5ef4956688a05 (patch)
tree58fafdd406467bd6e537b555eb997a5f495c186e /Kernel
parent8aab8faf305c8e9ba2883232e30f27822feb4ba5 (diff)
downloadserenity-eff27f39d595a7e90b230d2580a5ef4956688a05.zip
Kernel: Store previous thread state upon all transitions to Stopped (#1753)
We now store the previous thread state in m_stop_state for all transitions to the Stopped state via Thread::set_state. Fixes #1752 whereupon resuming a thread that was stopped with SIGTSTP, the previous state of the thread is not remembered correctly, resulting in m_stop_state == State::Invalid and the associated assertion fails.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Thread.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index 1e0e871309..53b6f49b63 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -499,7 +499,6 @@ ShouldUnblockThread Thread::dispatch_signal(u8 signal)
if (signal == SIGSTOP) {
if (!is_stopped()) {
m_stop_signal = SIGSTOP;
- m_stop_state = m_state;
set_state(State::Stopped);
}
return ShouldUnblockThread::No;
@@ -526,7 +525,6 @@ ShouldUnblockThread Thread::dispatch_signal(u8 signal)
// make sure SemiPermanentBlocker is unblocked
if (m_blocker && m_blocker->is_reason_signal())
unblock();
- m_stop_state = m_state;
set_state(Stopped);
return ShouldUnblockThread::No;
}
@@ -757,6 +755,10 @@ void Thread::set_state(State new_state)
ASSERT(m_blocker != nullptr);
}
+ if (new_state == Stopped) {
+ m_stop_state = m_state;
+ }
+
m_state = new_state;
if (m_process.pid() != 0) {
Scheduler::update_state_for_thread(*this);