diff --git a/dlls/kernel/thread.c b/dlls/kernel/thread.c index 0cbddd264ce..3c5bbd90fd1 100644 --- a/dlls/kernel/thread.c +++ b/dlls/kernel/thread.c @@ -114,22 +114,6 @@ static void CALLBACK THREAD_Start( void *ptr ) } -/*********************************************************************** - * cleanup_teb - * - * Cleanup the TEB structure; might be called from a different thread. - */ -static void cleanup_teb( struct wine_pthread_thread_info *info ) -{ - TEB *teb = (TEB *)info->teb_base; - - close( teb->wait_fd[0] ); - close( teb->wait_fd[1] ); - close( teb->reply_fd ); - close( teb->request_fd ); -} - - /*********************************************************************** * CreateThread (KERNEL32.@) */ @@ -229,7 +213,6 @@ void WINAPI ExitThread( DWORD code ) /* [in] Exit code for this thread */ info.stack_base = NtCurrentTeb()->DeallocationStack; info.teb_base = NtCurrentTeb(); info.teb_sel = wine_get_fs(); - info.cleanup = cleanup_teb; info.exit_status = code; size = 0; @@ -251,6 +234,11 @@ void WINAPI ExitThread( DWORD code ) /* [in] Exit code for this thread */ 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 ); } } diff --git a/include/wine/pthread.h b/include/wine/pthread.h index f94794f27db..b8add660ca6 100644 --- a/include/wine/pthread.h +++ b/include/wine/pthread.h @@ -94,7 +94,6 @@ struct wine_pthread_thread_info int pid; /* Unix process id */ int tid; /* Unix thread id */ void (*entry)( struct wine_pthread_thread_info *info ); /* thread entry point */ - void (*cleanup)( struct wine_pthread_thread_info *info ); /* thread cleanup function */ int exit_status; /* thread exit status when calling wine_pthread_exit_thread */ }; diff --git a/loader/kthread.c b/loader/kthread.c index 436f059b701..46940ea7fd5 100644 --- a/loader/kthread.c +++ b/loader/kthread.c @@ -189,7 +189,6 @@ static void cleanup_thread( void *ptr ) { /* copy the info structure since it is on the stack we will free */ struct wine_pthread_thread_info info = *(struct wine_pthread_thread_info *)ptr; - if (info.cleanup) info.cleanup( &info ); wine_ldt_free_fs( info.teb_sel ); munmap( info.stack_base, info.stack_size ); munmap( info.teb_base, info.teb_size ); diff --git a/loader/pthread.c b/loader/pthread.c index e8469c24db4..df09e067918 100644 --- a/loader/pthread.c +++ b/loader/pthread.c @@ -162,7 +162,6 @@ void wine_pthread_exit_thread( struct wine_pthread_thread_info *info ) if ((free_info = interlocked_xchg_ptr( (void **)&previous_info, cleanup_info )) != NULL) { pthread_join( free_info->self, &ptr ); - if (free_info->thread_info.cleanup) free_info->thread_info.cleanup( &free_info->thread_info ); wine_ldt_free_fs( free_info->thread_info.teb_sel ); munmap( free_info->thread_info.teb_base, free_info->thread_info.teb_size ); }