Alexandre Julliard : server: Make the select cookie a client_ptr_t instead of a void pointer.
Alexandre Julliard
julliard at winehq.org
Tue Dec 30 06:56:55 CST 2008
Module: wine
Branch: master
Commit: 45c991937ac0ba0a634df9db3ced2d811fd4ef24
URL: http://source.winehq.org/git/wine.git/?a=commit;h=45c991937ac0ba0a634df9db3ced2d811fd4ef24
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Dec 29 17:19:26 2008 +0100
server: Make the select cookie a client_ptr_t instead of a void pointer.
---
dlls/ntdll/sync.c | 4 ++--
include/wine/server_protocol.h | 8 ++++----
server/protocol.def | 6 +++---
server/thread.c | 18 ++++++++----------
server/trace.c | 4 +++-
5 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 0614eea..a5767f3 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -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;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index b263a2d..4dcd50d 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -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 */
diff --git a/server/protocol.def b/server/protocol.def
index 6f8dd2c..daa15b7 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -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 */
diff --git a/server/thread.c b/server/thread.c
index 1eeb59f..98a24d8 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -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;
}
diff --git a/server/trace.c b/server/trace.c
index f63e20a..fb717d0 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -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=" );
More information about the wine-cvs
mailing list