[kernel] Clean up process::exit

Make process::exit slightly more resilient to being called again.
This commit is contained in:
Justin C. Miller
2021-01-06 23:25:48 -08:00
parent 3a67e461de
commit bdcd0c2fda

View File

@@ -52,16 +52,13 @@ void
process::exit(unsigned code)
{
// TODO: make this thread-safe
if (m_state != state::running)
return;
else
m_state = state::exited;
m_return_code = code;
close();
for (auto *thread : m_threads) {
thread->exit(code);
}
m_return_code = code;
close();
if (this == bsp_cpu_data.p)
scheduler::get().schedule();