ntdll: Don't lock mutexes during process exit.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-09-22 11:28:41 +02:00
parent d8f7d54573
commit 9c8dce2155
3 changed files with 6 additions and 5 deletions

View File

@ -1042,7 +1042,6 @@ done:
*/
NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
{
static BOOL clean_exit;
NTSTATUS ret;
BOOL self;
@ -1056,8 +1055,8 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
SERVER_END_REQ;
if (self)
{
if (!handle) clean_exit = TRUE;
else if (clean_exit) exit_process( exit_code );
if (!handle) process_exiting = TRUE;
else if (process_exiting) exit_process( exit_code );
else abort_process( exit_code );
}
return ret;

View File

@ -105,6 +105,7 @@ static const char *server_dir;
unsigned int server_cpus = 0;
BOOL is_wow64 = FALSE;
BOOL process_exiting = FALSE;
timeout_t server_start_time = 0; /* time of server startup */

View File

@ -132,6 +132,7 @@ extern char **main_envp DECLSPEC_HIDDEN;
extern WCHAR **main_wargv DECLSPEC_HIDDEN;
extern unsigned int server_cpus DECLSPEC_HIDDEN;
extern BOOL is_wow64 DECLSPEC_HIDDEN;
extern BOOL process_exiting DECLSPEC_HIDDEN;
extern HANDLE keyed_event DECLSPEC_HIDDEN;
extern timeout_t server_start_time DECLSPEC_HIDDEN;
extern sigset_t server_block_set DECLSPEC_HIDDEN;
@ -280,12 +281,12 @@ static inline void *get_signal_stack(void)
static inline void mutex_lock( pthread_mutex_t *mutex )
{
pthread_mutex_lock( mutex );
if (!process_exiting) pthread_mutex_lock( mutex );
}
static inline void mutex_unlock( pthread_mutex_t *mutex )
{
pthread_mutex_unlock( mutex );
if (!process_exiting) pthread_mutex_unlock( mutex );
}
#ifndef _WIN64