mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 18:24:45 -05:00
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.
This commit is contained in:
parent
8aab8faf30
commit
eff27f39d5
Notes:
sideshowbarker
2024-07-19 07:41:42 +09:00
Author: https://github.com/peterdn 🔰 Commit: https://github.com/SerenityOS/serenity/commit/eff27f39d59 Pull-request: https://github.com/SerenityOS/serenity/pull/1753 Issue: https://github.com/SerenityOS/serenity/issues/1752
1 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue