Kernel: Fix process exiting infinite loop

If process was exiting and had a process waiting for it and that waiting
process got interrupted, the exiting process could never exit.
This commit is contained in:
Bananymous 2024-07-18 21:40:44 +03:00
parent 3ab1214012
commit 974b9b992d
1 changed files with 7 additions and 1 deletions

View File

@ -566,7 +566,13 @@ namespace Kernel
return BAN::Error::from_errno(ECHILD);
while (!target->m_exit_status.exited)
TRY(Thread::current().block_or_eintr_indefinite(target->m_exit_status.semaphore));
{
if (auto ret = Thread::current().block_or_eintr_indefinite(target->m_exit_status.thread_blocker); ret.is_error())
{
target->m_exit_status.waiting--;
return ret.release_error();
}
}
int exit_status = target->m_exit_status.exit_code;
target->m_exit_status.waiting--;