Fixed race condition when a thread gets killed right after starting.

This commit is contained in:
Alexandre Julliard 2002-08-13 18:24:27 +00:00
parent 6b97f5eef8
commit 714156d7ab
2 changed files with 2 additions and 2 deletions

View file

@ -680,6 +680,7 @@ void CLIENT_InitThread(void)
wine_server_send_fd( reply_pipe[1] );
wine_server_send_fd( teb->wait_fd[1] );
teb->reply_fd = reply_pipe[0];
close( reply_pipe[1] );
/* set close on exec flag */
fcntl( teb->reply_fd, F_SETFD, 1 );
@ -699,7 +700,6 @@ void CLIENT_InitThread(void)
version = reply->version;
if (reply->boot) boot_thread_id = teb->tid;
else if (boot_thread_id == teb->tid) boot_thread_id = 0;
close( reply_pipe[1] );
}
SERVER_END_REQ;

View file

@ -341,7 +341,7 @@ int receive_fd( struct process *process )
if (data.tid) thread = get_thread_from_id( data.tid );
else thread = (struct thread *)grab_object( process->thread_list );
if (!thread || thread->process != process)
if (!thread || thread->process != process || thread->state == TERMINATED)
{
if (debug_level)
fprintf( stderr, "%08x: *fd* %d <- %d bad thread id\n",