Revert the thread exit race fix for now, it doesn't work right on

pthreads.
This commit is contained in:
Alexandre Julliard 2004-02-05 17:45:31 +00:00
parent 4fac95df3d
commit 163396b955
4 changed files with 5 additions and 20 deletions

View File

@ -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.@) * CreateThread (KERNEL32.@)
*/ */
@ -229,7 +213,6 @@ void WINAPI ExitThread( DWORD code ) /* [in] Exit code for this thread */
info.stack_base = NtCurrentTeb()->DeallocationStack; info.stack_base = NtCurrentTeb()->DeallocationStack;
info.teb_base = NtCurrentTeb(); info.teb_base = NtCurrentTeb();
info.teb_sel = wine_get_fs(); info.teb_sel = wine_get_fs();
info.cleanup = cleanup_teb;
info.exit_status = code; info.exit_status = code;
size = 0; size = 0;
@ -251,6 +234,11 @@ void WINAPI ExitThread( DWORD code ) /* [in] Exit code for this thread */
sigaddset( &block_set, SIGTERM ); sigaddset( &block_set, SIGTERM );
sigprocmask( SIG_BLOCK, &block_set, NULL ); 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_pthread_exit_thread( &info );
} }
} }

View File

@ -94,7 +94,6 @@ struct wine_pthread_thread_info
int pid; /* Unix process id */ int pid; /* Unix process id */
int tid; /* Unix thread id */ int tid; /* Unix thread id */
void (*entry)( struct wine_pthread_thread_info *info ); /* thread entry point */ 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 */ int exit_status; /* thread exit status when calling wine_pthread_exit_thread */
}; };

View File

@ -189,7 +189,6 @@ static void cleanup_thread( void *ptr )
{ {
/* copy the info structure since it is on the stack we will free */ /* 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; 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 ); wine_ldt_free_fs( info.teb_sel );
munmap( info.stack_base, info.stack_size ); munmap( info.stack_base, info.stack_size );
munmap( info.teb_base, info.teb_size ); munmap( info.teb_base, info.teb_size );

View File

@ -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) if ((free_info = interlocked_xchg_ptr( (void **)&previous_info, cleanup_info )) != NULL)
{ {
pthread_join( free_info->self, &ptr ); 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 ); wine_ldt_free_fs( free_info->thread_info.teb_sel );
munmap( free_info->thread_info.teb_base, free_info->thread_info.teb_size ); munmap( free_info->thread_info.teb_base, free_info->thread_info.teb_size );
} }