Kernel: Fix process exit when there are multiple threads
This commit is contained in:
parent
44b762f916
commit
79a2b84c81
|
@ -301,8 +301,14 @@ namespace Kernel
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!m_threads.empty())
|
for (size_t i = 0; i < m_threads.size(); i++)
|
||||||
m_threads.front()->on_exit();
|
{
|
||||||
|
if (m_threads[i] == &Thread::current())
|
||||||
|
continue;
|
||||||
|
m_threads[i]->add_signal(SIGKILL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread::current().on_exit();
|
||||||
|
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
@ -2310,14 +2316,10 @@ namespace Kernel
|
||||||
return BAN::Error::from_errno(EINVAL);
|
return BAN::Error::from_errno(EINVAL);
|
||||||
|
|
||||||
TRY(m_exited_pthreads.emplace_back(Thread::current().tid(), value));
|
TRY(m_exited_pthreads.emplace_back(Thread::current().tid(), value));
|
||||||
for (auto* thread : m_threads)
|
|
||||||
{
|
|
||||||
if (thread != &Thread::current())
|
|
||||||
continue;
|
|
||||||
m_pthread_exit_blocker.unblock();
|
m_pthread_exit_blocker.unblock();
|
||||||
m_process_lock.unlock();
|
m_process_lock.unlock();
|
||||||
thread->on_exit();
|
Thread::current().on_exit();
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue