1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix exit_thread(2) multi-threaded process destruction.

This commit is contained in:
Jonas 'Sortie' Termansen 2016-10-09 22:56:30 +02:00
parent b3f31b1adb
commit 2d91c7d385

View file

@ -342,7 +342,8 @@ int sys_exit_thread(int requested_exit_code,
if ( !(flags & EXIT_THREAD_ONLY_IF_OTHERS) || is_others )
thread->pledged_destruction = true;
bool are_threads_exiting = false;
if ( (flags & EXIT_THREAD_PROCESS) || !is_others )
bool do_exit = (flags & EXIT_THREAD_PROCESS) || !is_others;
if ( do_exit )
process->threads_exiting = true;
else if ( process->threads_exiting )
are_threads_exiting = true;
@ -381,7 +382,7 @@ int sys_exit_thread(int requested_exit_code,
if ( flags & EXIT_THREAD_ZERO )
ZeroUser(extended.zero_from, extended.zero_size);
if ( !is_others )
if ( do_exit )
{
// Validate the requested exit code such that the process can't exit
// with an impossible exit status or that it wasn't actually terminated.