Alexandre Julliard : server:
Add support for storing an event to signal upon async I/O completion.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Mar 21 17:02:45 CDT 2007
Module: wine
Branch: master
Commit: fa4679fea6c5a6227d5d40e410d93af3d01d984c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fa4679fea6c5a6227d5d40e410d93af3d01d984c
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Mar 21 14:27:52 2007 +0100
server: Add support for storing an event to signal upon async I/O completion.
---
include/wine/server_protocol.h | 3 ++-
server/async.c | 16 ++++++++++++++--
server/protocol.def | 1 +
server/trace.c | 3 ++-
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index b97e39a..68cc112 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -162,6 +162,7 @@ typedef struct
void *callback;
void *iosb;
void *arg;
+ obj_handle_t event;
} async_data_t;
@@ -4699,6 +4700,6 @@ union generic_reply
struct allocate_locally_unique_id_reply allocate_locally_unique_id_reply;
};
-#define SERVER_PROTOCOL_VERSION 283
+#define SERVER_PROTOCOL_VERSION 284
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/async.c b/server/async.c
index b88f8f5..bc5893a 100644
--- a/server/async.c
+++ b/server/async.c
@@ -38,6 +38,7 @@ struct async
struct thread *thread; /* owning thread */
struct list queue_entry; /* entry in file descriptor queue */
struct timeout_user *timeout;
+ struct event *event;
async_data_t data; /* data for async I/O call */
};
@@ -73,6 +74,7 @@ static void async_destroy( struct object *obj )
assert( obj->ops == &async_ops );
if (async->timeout) remove_timeout_user( async->timeout );
+ if (async->event) release_object( async->event );
release_object( async->thread );
}
@@ -109,11 +111,20 @@ static void async_timeout( void *private )
struct async *create_async( struct thread *thread, const struct timeval *timeout,
struct list *queue, const async_data_t *data )
{
- struct async *async = alloc_object( &async_ops );
+ struct event *event = NULL;
+ struct async *async;
- if (!async) return NULL;
+ if (data->event && !(event = get_event_obj( thread->process, data->event, EVENT_MODIFY_STATE )))
+ return NULL;
+
+ if (!(async = alloc_object( &async_ops )))
+ {
+ if (event) release_object( event );
+ return NULL;
+ }
async->thread = (struct thread *)grab_object( thread );
+ async->event = event;
async->data = *data;
list_add_tail( queue, &async->queue_entry );
@@ -121,6 +132,7 @@ struct async *create_async( struct thread *thread, const struct timeval *timeout
if (timeout) async->timeout = add_timeout_user( timeout, async_timeout, async );
else async->timeout = NULL;
+ if (event) reset_event( event );
return async;
}
diff --git a/server/protocol.def b/server/protocol.def
index 145fbeb..3d0618a 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -178,6 +178,7 @@ typedef struct
void *callback; /* client-side callback to call upon end of async */
void *iosb; /* I/O status block in client addr space */
void *arg; /* opaque user data to pass to callback */
+ obj_handle_t event; /* event to signal when done */
} async_data_t;
/* structures for extra message data */
diff --git a/server/trace.c b/server/trace.c
index a840c13..d04c4c5 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -245,7 +245,8 @@ static void dump_apc_result( const apc_result_t *result )
static void dump_async_data( const async_data_t *data )
{
- fprintf( stderr, "{callback=%p,iosb=%p,arg=%p}", data->callback, data->iosb, data->arg );
+ fprintf( stderr, "{callback=%p,iosb=%p,arg=%p,event=%p}",
+ data->callback, data->iosb, data->arg, data->event );
}
static void dump_luid( const luid_t *luid )
More information about the wine-cvs
mailing list