1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 11:55:08 +00:00

Kernel: Always return from Thread::wait_on

We need to always return from Thread::wait_on, even when a thread
is being killed. This is necessary so that the kernel call stack
can clean up and release references held by it. Then, right before
transitioning back to user mode, we check if the thread is
supposed to die, and at that point change the thread state to
Dying to prevent further scheduling of this thread.

This addresses some possible resource leaks similar to #3073
This commit is contained in:
Tom 2020-08-10 14:05:24 -06:00 committed by Andreas Kling
parent 1f7190d3bd
commit 49d5232f33
4 changed files with 28 additions and 33 deletions

View file

@ -273,10 +273,6 @@ void Process::kill_threads_except_self()
// At this point, we have no joiner anymore
thread.m_joiner = nullptr;
thread.set_should_die();
if (thread.state() != Thread::State::Dead)
thread.set_state(Thread::State::Dying);
return IterationDecision::Continue;
});