Commit 9c8dce21 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Don't lock mutexes during process exit.

parent d8f7d545
...@@ -1042,7 +1042,6 @@ done: ...@@ -1042,7 +1042,6 @@ done:
*/ */
NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code ) NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
{ {
static BOOL clean_exit;
NTSTATUS ret; NTSTATUS ret;
BOOL self; BOOL self;
...@@ -1056,8 +1055,8 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code ) ...@@ -1056,8 +1055,8 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
SERVER_END_REQ; SERVER_END_REQ;
if (self) if (self)
{ {
if (!handle) clean_exit = TRUE; if (!handle) process_exiting = TRUE;
else if (clean_exit) exit_process( exit_code ); else if (process_exiting) exit_process( exit_code );
else abort_process( exit_code ); else abort_process( exit_code );
} }
return ret; return ret;
......
...@@ -105,6 +105,7 @@ static const char *server_dir; ...@@ -105,6 +105,7 @@ static const char *server_dir;
unsigned int server_cpus = 0; unsigned int server_cpus = 0;
BOOL is_wow64 = FALSE; BOOL is_wow64 = FALSE;
BOOL process_exiting = FALSE;
timeout_t server_start_time = 0; /* time of server startup */ timeout_t server_start_time = 0; /* time of server startup */
......
...@@ -132,6 +132,7 @@ extern char **main_envp DECLSPEC_HIDDEN; ...@@ -132,6 +132,7 @@ extern char **main_envp DECLSPEC_HIDDEN;
extern WCHAR **main_wargv DECLSPEC_HIDDEN; extern WCHAR **main_wargv DECLSPEC_HIDDEN;
extern unsigned int server_cpus DECLSPEC_HIDDEN; extern unsigned int server_cpus DECLSPEC_HIDDEN;
extern BOOL is_wow64 DECLSPEC_HIDDEN; extern BOOL is_wow64 DECLSPEC_HIDDEN;
extern BOOL process_exiting DECLSPEC_HIDDEN;
extern HANDLE keyed_event DECLSPEC_HIDDEN; extern HANDLE keyed_event DECLSPEC_HIDDEN;
extern timeout_t server_start_time DECLSPEC_HIDDEN; extern timeout_t server_start_time DECLSPEC_HIDDEN;
extern sigset_t server_block_set DECLSPEC_HIDDEN; extern sigset_t server_block_set DECLSPEC_HIDDEN;
...@@ -280,12 +281,12 @@ static inline void *get_signal_stack(void) ...@@ -280,12 +281,12 @@ static inline void *get_signal_stack(void)
static inline void mutex_lock( pthread_mutex_t *mutex ) 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 ) static inline void mutex_unlock( pthread_mutex_t *mutex )
{ {
pthread_mutex_unlock( mutex ); if (!process_exiting) pthread_mutex_unlock( mutex );
} }
#ifndef _WIN64 #ifndef _WIN64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment