Tim Clem : ntdll: Decrement thread count from exit_thread and exit the process if needed.
Module: wine Branch: master Commit: fac1aabbef3753afc53a4ea4f933b3d0516fd302 URL: https://gitlab.winehq.org/wine/wine/-/commit/fac1aabbef3753afc53a4ea4f933b3d... Author: Tim Clem <tclem(a)codeweavers.com> Date: Mon Apr 24 11:51:31 2023 -0700 ntdll: Decrement thread count from exit_thread and exit the process if needed. --- dlls/ntdll/unix/thread.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 2686a8365cf..d76de4fcc98 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -1429,6 +1429,8 @@ static DECLSPEC_NORETURN void exit_thread( int status ) pthread_sigmask( SIG_BLOCK, &server_block_set, NULL ); + if (InterlockedDecrement( &nb_threads ) <= 0) exit_process( status ); + if ((teb = InterlockedExchangePointer( &prev_teb, NtCurrentTeb() ))) { struct ntdll_thread_data *thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
participants (1)
-
Alexandre Julliard