Commit 45c99193 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Make the select cookie a client_ptr_t instead of a void pointer.

parent 93737d55
......@@ -812,7 +812,7 @@ static int wait_reply( void *cookie )
if (ret == sizeof(reply))
{
if (!reply.cookie) break; /* thread got killed */
if (reply.cookie == cookie) return reply.signaled;
if (wine_server_get_ptr(reply.cookie) == cookie) return reply.signaled;
/* we stole another reply, wait for the real one */
signaled = wait_reply( cookie );
/* and now put the wrong one back in the pipe */
......@@ -1091,7 +1091,7 @@ NTSTATUS NTDLL_wait_for_multiple_objects( UINT count, const HANDLE *handles, UIN
SERVER_START_REQ( select )
{
req->flags = flags;
req->cookie = &cookie;
req->cookie = wine_server_client_ptr( &cookie );
req->signal = wine_server_obj_handle( signal_object );
req->prev_apc = apc_handle;
req->timeout = abs_timeout;
......
......@@ -135,8 +135,8 @@ struct send_fd
struct wake_up_reply
{
void *cookie;
int signaled;
client_ptr_t cookie;
int signaled;
};
......@@ -860,7 +860,7 @@ struct select_request
{
struct request_header __header;
int flags;
void* cookie;
client_ptr_t cookie;
obj_handle_t signal;
obj_handle_t prev_apc;
timeout_t timeout;
......@@ -5052,6 +5052,6 @@ union generic_reply
struct set_window_layered_info_reply set_window_layered_info_reply;
};
#define SERVER_PROTOCOL_VERSION 358
#define SERVER_PROTOCOL_VERSION 359
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -151,8 +151,8 @@ struct send_fd
/* structure sent by the server on the wait fifo */
struct wake_up_reply
{
void *cookie; /* magic cookie that was passed in select_request */
int signaled; /* wait result */
client_ptr_t cookie; /* magic cookie that was passed in select_request */
int signaled; /* wait result */
};
/* NT-style timeout, in 100ns units, negative means relative timeout */
......@@ -748,7 +748,7 @@ typedef union
/* Wait for handles */
@REQ(select)
int flags; /* wait flags (see below) */
void* cookie; /* magic cookie to return to client */
client_ptr_t cookie; /* magic cookie to return to client */
obj_handle_t signal; /* object to signal (0 if none) */
obj_handle_t prev_apc; /* handle to previous APC */
timeout_t timeout; /* timeout */
......
......@@ -58,7 +58,7 @@ struct thread_wait
struct thread *thread; /* owner thread */
int count; /* count of objects */
int flags;
void *cookie; /* magic cookie to return to client */
client_ptr_t cookie; /* magic cookie to return to client */
timeout_t timeout;
struct timeout_user *user;
struct wait_queue_entry queues[1];
......@@ -560,7 +560,7 @@ static int check_wait( struct thread *thread )
}
/* send the wakeup signal to a thread */
static int send_thread_wakeup( struct thread *thread, void *cookie, int signaled )
static int send_thread_wakeup( struct thread *thread, client_ptr_t cookie, int signaled )
{
struct wake_up_reply reply;
int ret;
......@@ -583,15 +583,14 @@ static int send_thread_wakeup( struct thread *thread, void *cookie, int signaled
int wake_thread( struct thread *thread )
{
int signaled, count;
void *cookie;
client_ptr_t cookie;
for (count = 0; thread->wait; count++)
{
if ((signaled = check_wait( thread )) == -1) break;
cookie = thread->wait->cookie;
if (debug_level) fprintf( stderr, "%04x: *wakeup* signaled=%d cookie=%p\n",
thread->id, signaled, cookie );
if (debug_level) fprintf( stderr, "%04x: *wakeup* signaled=%d\n", thread->id, signaled );
end_wait( thread );
if (send_thread_wakeup( thread, cookie, signaled ) == -1) /* error */
break;
......@@ -604,14 +603,13 @@ static void thread_timeout( void *ptr )
{
struct thread_wait *wait = ptr;
struct thread *thread = wait->thread;
void *cookie = wait->cookie;
client_ptr_t cookie = wait->cookie;
wait->user = NULL;
if (thread->wait != wait) return; /* not the top-level wait, ignore it */
if (thread->suspend + thread->process->suspend > 0) return; /* suspended, ignore it */
if (debug_level) fprintf( stderr, "%04x: *wakeup* signaled=%d cookie=%p\n",
thread->id, (int)STATUS_TIMEOUT, cookie );
if (debug_level) fprintf( stderr, "%04x: *wakeup* signaled=TIMEOUT\n", thread->id );
end_wait( thread );
if (send_thread_wakeup( thread, cookie, STATUS_TIMEOUT ) == -1) return;
/* check if other objects have become signaled in the meantime */
......@@ -634,7 +632,7 @@ static int signal_object( obj_handle_t handle )
}
/* select on a list of handles */
static timeout_t select_on( unsigned int count, void *cookie, const obj_handle_t *handles,
static timeout_t select_on( unsigned int count, client_ptr_t cookie, const obj_handle_t *handles,
int flags, timeout_t timeout, obj_handle_t signal_obj )
{
int ret;
......@@ -916,7 +914,7 @@ void kill_thread( struct thread *thread, int violent_death )
if (thread->wait)
{
while (thread->wait) end_wait( thread );
send_thread_wakeup( thread, NULL, STATUS_PENDING );
send_thread_wakeup( thread, 0, STATUS_PENDING );
/* if it is waiting on the socket, we don't need to send a SIGQUIT */
violent_death = 0;
}
......
......@@ -1175,7 +1175,9 @@ static void dump_open_thread_reply( const struct open_thread_reply *req )
static void dump_select_request( const struct select_request *req )
{
fprintf( stderr, " flags=%d,", req->flags );
fprintf( stderr, " cookie=%p,", req->cookie );
fprintf( stderr, " cookie=" );
dump_uint64( &req->cookie );
fprintf( stderr, "," );
fprintf( stderr, " signal=%04x,", req->signal );
fprintf( stderr, " prev_apc=%04x,", req->prev_apc );
fprintf( stderr, " timeout=" );
......
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