mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
WaitBlocker: don't unblock if thread has pending SIGCONT
Previosuly, if we sent a SIGCONT to a stopped thread and then waitpid() with WSTOPPED on that thread before the signal was dispatched, then the WaitBlocker would first unblock (because the thread is stopped) and only after that the thread would get the SIGCONT signal. This would mean that when waitpid returns the waitee is not stopped. To fix this, we do not unblock the waiting thread if the waitee thread has a pending SIGCONT.
This commit is contained in:
parent
14047ca432
commit
c9396be83f
Notes:
sideshowbarker
2024-07-19 08:05:36 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/c9396be83f6 Pull-request: https://github.com/SerenityOS/serenity/pull/1517 Reviewed-by: https://github.com/awesomekling
1 changed files with 6 additions and 1 deletions
|
@ -261,7 +261,12 @@ bool Thread::WaitBlocker::should_unblock(Thread& thread, time_t, long)
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
|
|
||||||
bool child_exited = child.is_dead();
|
bool child_exited = child.is_dead();
|
||||||
bool child_stopped = child.thread_count() && child.any_thread().state() == Thread::State::Stopped;
|
bool child_stopped = false;
|
||||||
|
if (child.thread_count()) {
|
||||||
|
auto& child_thread = child.any_thread();
|
||||||
|
if (child_thread.state() == Thread::State::Stopped && !child_thread.has_pending_signal(SIGCONT))
|
||||||
|
child_stopped = true;
|
||||||
|
}
|
||||||
|
|
||||||
bool wait_finished = ((m_wait_options & WEXITED) && child_exited)
|
bool wait_finished = ((m_wait_options & WEXITED) && child_exited)
|
||||||
|| ((m_wait_options & WSTOPPED) && child_stopped);
|
|| ((m_wait_options & WSTOPPED) && child_stopped);
|
||||||
|
|
Loading…
Reference in a new issue