Commit 714156d7 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 6b97f5ee
......@@ -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;
......
......@@ -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",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment