mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
Kernel: Delete non-main threads immediately after finalizing them
Previously we would wait until the whole process died before actually deleting its threads.
This commit is contained in:
parent
55d6efd485
commit
3ad6ae1842
1 changed files with 8 additions and 1 deletions
|
@ -157,15 +157,22 @@ const char* Thread::state_string() const
|
||||||
|
|
||||||
void Thread::finalize()
|
void Thread::finalize()
|
||||||
{
|
{
|
||||||
|
ASSERT(current == g_finalizer);
|
||||||
|
|
||||||
dbgprintf("Finalizing Thread %u in %s(%u)\n", tid(), m_process.name().characters(), pid());
|
dbgprintf("Finalizing Thread %u in %s(%u)\n", tid(), m_process.name().characters(), pid());
|
||||||
set_state(Thread::State::Dead);
|
set_state(Thread::State::Dead);
|
||||||
|
|
||||||
if (this == &m_process.main_thread())
|
if (this == &m_process.main_thread()) {
|
||||||
m_process.finalize();
|
m_process.finalize();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::finalize_dying_threads()
|
void Thread::finalize_dying_threads()
|
||||||
{
|
{
|
||||||
|
ASSERT(current == g_finalizer);
|
||||||
Vector<Thread*, 32> dying_threads;
|
Vector<Thread*, 32> dying_threads;
|
||||||
{
|
{
|
||||||
InterruptDisabler disabler;
|
InterruptDisabler disabler;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue