Commit 875c4b3c authored by Alexandre Julliard's avatar Alexandre Julliard

Added server pid and tid in init_thread request, and use them in

CLIENT_InitThread.
parent ed494ec5
......@@ -97,6 +97,11 @@ struct init_thread_request
{
int unix_pid; /* Unix pid of new thread */
};
struct init_thread_reply
{
void* pid; /* process id of the new thread's process */
void* tid; /* thread id of the new thread */
};
/* Terminate a process */
......
......@@ -318,10 +318,16 @@ int CLIENT_InitServer(void)
*/
int CLIENT_InitThread(void)
{
struct init_thread_request init;
init.unix_pid = getpid();
CLIENT_SendRequest( REQ_INIT_THREAD, -1, 1, &init, sizeof(init) );
return CLIENT_WaitReply( NULL, NULL, 0 );
THDB *thdb = THREAD_Current();
struct init_thread_request req;
struct init_thread_reply reply;
req.unix_pid = getpid();
CLIENT_SendRequest( REQ_INIT_THREAD, -1, 1, &req, sizeof(req) );
if (CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL )) return -1;
thdb->process->server_pid = reply.pid;
thdb->server_tid = reply.tid;
return 0;
}
......
......@@ -306,9 +306,6 @@ BOOL PROCESS_Init(void)
/* Create the environment DB of the first process */
if (!PROCESS_BuildEnvDB( &initial_pdb )) return FALSE;
/* Initialize the first thread */
if (CLIENT_InitThread()) return FALSE;
/* Create the SEGPTR heap */
if (!(SegptrHeap = HeapCreate( HEAP_WINE_SEGPTR, 0, 0 ))) return FALSE;
......
......@@ -80,12 +80,8 @@ int *__h_errno_location()
*/
static void SYSDEPS_StartThread( THDB *thdb )
{
struct init_thread_request init;
SET_CUR_THREAD( thdb );
init.unix_pid = getpid();
CLIENT_SendRequest( REQ_INIT_THREAD, -1, 1, &init, sizeof(init) );
CLIENT_WaitReply( NULL, NULL, 0 );
CLIENT_InitThread();
thdb->startup();
_exit(0); /* should never get here */
}
......
......@@ -201,6 +201,7 @@ THDB *THREAD_CreateInitialThread( PDB *pdb, int server_fd )
/* Now proceed with normal initialization */
if (CLIENT_InitThread()) return NULL;
if (!THREAD_InitTHDB( &initial_thdb, 0, TRUE, NULL )) return NULL;
return &initial_thdb;
}
......@@ -344,6 +345,7 @@ DWORD WINAPI GetCurrentThreadId(void)
{
THDB *thdb = THREAD_Current();
assert( thdb );
assert( thdb->server_tid );
return (DWORD)thdb->server_tid;
}
......
......@@ -160,6 +160,8 @@ DECL_HANDLER(init_process)
/* initialize a new thread */
DECL_HANDLER(init_thread)
{
struct init_thread_reply reply;
if (current->state != STARTING)
{
fatal_protocol_error( "init_thread: already running\n" );
......@@ -169,7 +171,9 @@ DECL_HANDLER(init_thread)
current->unix_pid = req->unix_pid;
if (current->suspend > 0)
kill( current->unix_pid, SIGSTOP );
send_reply( current, -1, 0 );
reply.pid = current->process;
reply.tid = current;
send_reply( current, -1, 1, &reply, sizeof(reply) );
}
/* set the debug level */
......
......@@ -66,6 +66,13 @@ static int dump_init_thread_request( struct init_thread_request *req, int len )
return (int)sizeof(*req);
}
static int dump_init_thread_reply( struct init_thread_reply *req, int len )
{
fprintf( stderr, " pid=%p,", req->pid );
fprintf( stderr, " tid=%p", req->tid );
return (int)sizeof(*req);
}
static int dump_terminate_process_request( struct terminate_process_request *req, int len )
{
fprintf( stderr, " handle=%d,", req->handle );
......@@ -638,7 +645,7 @@ static const struct dumper dumpers[REQ_NB_REQUESTS] =
{ (int(*)(void *,int))dump_init_process_request,
(void(*)())dump_init_process_reply },
{ (int(*)(void *,int))dump_init_thread_request,
(void(*)())0 },
(void(*)())dump_init_thread_reply },
{ (int(*)(void *,int))dump_terminate_process_request,
(void(*)())0 },
{ (int(*)(void *,int))dump_terminate_thread_request,
......
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