Kernel: Add some sanity checks for existanse of threads

This commit is contained in:
Bananymous 2024-12-03 16:16:50 +02:00
parent fcc2814199
commit 2dec3a6c95
1 changed files with 8 additions and 2 deletions

View File

@ -293,6 +293,7 @@ namespace Kernel
child.exited = true; child.exited = true;
parent.add_pending_signal(SIGCHLD); parent.add_pending_signal(SIGCHLD);
if (!parent.m_threads.empty())
Processor::scheduler().unblock_thread(parent.m_threads.front()); Processor::scheduler().unblock_thread(parent.m_threads.front());
parent.m_child_exit_blocker.unblock(); parent.m_child_exit_blocker.unblock();
@ -307,6 +308,8 @@ namespace Kernel
while (!m_threads.empty()) while (!m_threads.empty())
m_threads.front()->on_exit(); m_threads.front()->on_exit();
ASSERT_NOT_REACHED();
} }
size_t Process::proc_meminfo(off_t offset, BAN::ByteSpan buffer) const size_t Process::proc_meminfo(off_t offset, BAN::ByteSpan buffer) const
@ -854,6 +857,8 @@ namespace Kernel
break; break;
process->add_pending_signal(SIGALRM); process->add_pending_signal(SIGALRM);
ASSERT(!process->m_threads.empty());
Processor::scheduler().unblock_thread(process->m_threads.front()); Processor::scheduler().unblock_thread(process->m_threads.front());
s_alarm_processes.remove(s_alarm_processes.begin()); s_alarm_processes.remove(s_alarm_processes.begin());
@ -2004,6 +2009,7 @@ namespace Kernel
if (signal) if (signal)
{ {
process.add_pending_signal(signal); process.add_pending_signal(signal);
if (!process.m_threads.empty())
Processor::scheduler().unblock_thread(process.m_threads.front()); Processor::scheduler().unblock_thread(process.m_threads.front());
} }
return (pid > 0) ? BAN::Iteration::Break : BAN::Iteration::Continue; return (pid > 0) ? BAN::Iteration::Break : BAN::Iteration::Continue;