Moved the server part of the ExitThread functionality to ntdll.
This commit is contained in:
parent
a583b2570b
commit
6d07a9c39c
|
@ -24,7 +24,6 @@
|
|||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_TIMES_H
|
||||
#include <sys/times.h>
|
||||
|
@ -238,45 +237,8 @@ void WINAPI ExitThread( DWORD code ) /* [in] Exit code for this thread */
|
|||
}
|
||||
else
|
||||
{
|
||||
struct wine_pthread_thread_info info;
|
||||
sigset_t block_set;
|
||||
ULONG size;
|
||||
|
||||
LdrShutdownThread();
|
||||
RtlAcquirePebLock();
|
||||
RemoveEntryList( &NtCurrentTeb()->TlsLinks );
|
||||
RtlReleasePebLock();
|
||||
|
||||
info.stack_base = NtCurrentTeb()->DeallocationStack;
|
||||
info.teb_base = NtCurrentTeb();
|
||||
info.teb_sel = wine_get_fs();
|
||||
info.exit_status = code;
|
||||
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &info.stack_base, &size, MEM_RELEASE | MEM_SYSTEM );
|
||||
info.stack_size = size;
|
||||
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &info.teb_base, &size, MEM_RELEASE | MEM_SYSTEM );
|
||||
info.teb_size = size;
|
||||
|
||||
/* block the async signals */
|
||||
sigemptyset( &block_set );
|
||||
sigaddset( &block_set, SIGALRM );
|
||||
sigaddset( &block_set, SIGIO );
|
||||
sigaddset( &block_set, SIGINT );
|
||||
sigaddset( &block_set, SIGHUP );
|
||||
sigaddset( &block_set, SIGUSR1 );
|
||||
sigaddset( &block_set, SIGUSR2 );
|
||||
sigaddset( &block_set, SIGTERM );
|
||||
sigprocmask( SIG_BLOCK, &block_set, NULL );
|
||||
|
||||
close( NtCurrentTeb()->wait_fd[0] );
|
||||
close( NtCurrentTeb()->wait_fd[1] );
|
||||
close( NtCurrentTeb()->reply_fd );
|
||||
close( NtCurrentTeb()->request_fd );
|
||||
|
||||
wine_pthread_exit_thread( &info );
|
||||
wine_server_exit_thread( code );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1027,6 +1027,7 @@
|
|||
@ cdecl wine_server_handle_to_fd(long long ptr ptr)
|
||||
@ cdecl wine_server_release_fd(long long)
|
||||
@ cdecl wine_server_send_fd(long)
|
||||
@ cdecl wine_server_exit_thread(long)
|
||||
|
||||
# Codepages
|
||||
@ cdecl __wine_init_codepages(ptr ptr ptr)
|
||||
|
|
|
@ -118,6 +118,40 @@ static void fatal_perror( const char *err, ... )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* wine_server_exit_thread (NTDLL.@)
|
||||
*/
|
||||
void wine_server_exit_thread( int status )
|
||||
{
|
||||
struct wine_pthread_thread_info info;
|
||||
ULONG size;
|
||||
|
||||
RtlAcquirePebLock();
|
||||
RemoveEntryList( &NtCurrentTeb()->TlsLinks );
|
||||
RtlReleasePebLock();
|
||||
|
||||
info.stack_base = NtCurrentTeb()->DeallocationStack;
|
||||
info.teb_base = NtCurrentTeb();
|
||||
info.teb_sel = wine_get_fs();
|
||||
info.exit_status = status;
|
||||
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &info.stack_base, &size, MEM_RELEASE | MEM_SYSTEM );
|
||||
info.stack_size = size;
|
||||
|
||||
size = 0;
|
||||
NtFreeVirtualMemory( GetCurrentProcess(), &info.teb_base, &size, MEM_RELEASE | MEM_SYSTEM );
|
||||
info.teb_size = size;
|
||||
|
||||
sigprocmask( SIG_BLOCK, &block_set, NULL );
|
||||
close( NtCurrentTeb()->wait_fd[0] );
|
||||
close( NtCurrentTeb()->wait_fd[1] );
|
||||
close( NtCurrentTeb()->reply_fd );
|
||||
close( NtCurrentTeb()->request_fd );
|
||||
wine_pthread_exit_thread( &info );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* server_abort_thread
|
||||
*/
|
||||
|
|
|
@ -55,6 +55,7 @@ extern void wine_server_send_fd( int fd );
|
|||
extern int wine_server_fd_to_handle( int fd, unsigned int access, int inherit, obj_handle_t *handle );
|
||||
extern int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd, int *flags );
|
||||
extern void wine_server_release_fd( obj_handle_t handle, int unix_fd );
|
||||
extern void DECLSPEC_NORETURN wine_server_exit_thread( int status );
|
||||
|
||||
/* do a server call and set the last error code */
|
||||
inline static unsigned int wine_server_call_err( void *req_ptr )
|
||||
|
|
Loading…
Reference in New Issue