Kernel: Process now locks the mutex while modifying open files

This allows processes to be actually removed from the list instead
of dead locking
This commit is contained in:
Bananymous 2023-04-11 23:28:16 +03:00
parent 8d6db168d6
commit bdaf7cddcb
1 changed files with 5 additions and 3 deletions

View File

@ -52,10 +52,12 @@ namespace Kernel
} }
void Process::exit() void Process::exit()
{
{ {
LockGuard _(m_lock); LockGuard _(m_lock);
for (auto* thread : m_threads) for (auto* thread : m_threads)
thread->terminate(); thread->terminate();
}
while (!m_threads.empty()) while (!m_threads.empty())
PIT::sleep(1); PIT::sleep(1);
for (auto& open_fd : m_open_files) for (auto& open_fd : m_open_files)