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:
@@ -3357,9 +3357,8 @@ namespace Kernel
|
|||||||
{
|
{
|
||||||
LockGuard _(m_process_lock);
|
LockGuard _(m_process_lock);
|
||||||
|
|
||||||
// main thread cannot call pthread_exit
|
if (m_threads.size() == 1)
|
||||||
if (&Thread::current() == m_threads.front())
|
return sys_exit(0);
|
||||||
return BAN::Error::from_errno(EINVAL);
|
|
||||||
|
|
||||||
TRY(m_exited_pthreads.emplace_back(Thread::current().tid(), value));
|
TRY(m_exited_pthreads.emplace_back(Thread::current().tid(), value));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user