Kernel: Allow main thread to call pthread_exit

Apparently this is allowed. Also when last thread calls pthread_join
the process should also exit
This commit is contained in:
2026-04-21 00:23:35 +03:00
parent 72a24a0d38
commit 8665195350

View File

@@ -3357,9 +3357,8 @@ namespace Kernel
{
LockGuard _(m_process_lock);
// main thread cannot call pthread_exit
if (&Thread::current() == m_threads.front())
return BAN::Error::from_errno(EINVAL);
if (m_threads.size() == 1)
return sys_exit(0);
TRY(m_exited_pthreads.emplace_back(Thread::current().tid(), value));