Alexandre Julliard wrote:
Index: wine/include/wine/server.h diff -u -p wine/include/wine/server.h:1.21 wine/include/wine/server.h:1.22 --- wine/include/wine/server.h:1.21 Sun Jun 5 20:45:53 2005 +++ wine/include/wine/server.h Sun Jun 5 20:45:53 2005 @@ -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 )
Index: wine/dlls/ntdll/server.c diff -u -p wine/dlls/ntdll/server.c:1.21 wine/dlls/ntdll/server.c:1.22 --- wine/dlls/ntdll/server.c:1.21 Sun Jun 5 20:45:53 2005 +++ wine/dlls/ntdll/server.c Sun Jun 5 20:45:53 2005 @@ -119,6 +119,40 @@ static void fatal_perror( const char *er
/***********************************************************************
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
*/ void server_abort_thread( int status )
Index: wine/dlls/ntdll/ntdll.spec diff -u -p wine/dlls/ntdll/ntdll.spec:1.182 wine/dlls/ntdll/ntdll.spec:1.183 --- wine/dlls/ntdll/ntdll.spec:1.182 Sun Jun 5 20:45:53 2005 +++ wine/dlls/ntdll/ntdll.spec Sun Jun 5 20:45:53 2005 @@ -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)
Index: wine/dlls/kernel/thread.c diff -u -p wine/dlls/kernel/thread.c:1.23 wine/dlls/kernel/thread.c:1.24 --- wine/dlls/kernel/thread.c:1.23 Sun Jun 5 20:45:53 2005 +++ wine/dlls/kernel/thread.c Sun Jun 5 20:45:53 2005 @@ -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 ) /* } 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 );
}
Couldn't wine_server_exit_thread be merged into LdrShutdownThread to avoid this Wine-specific export?