Commit fa4679fe authored by Alexandre Julliard's avatar Alexandre Julliard

server: Add support for storing an event to signal upon async I/O completion.

parent 31ade1eb
...@@ -162,6 +162,7 @@ typedef struct ...@@ -162,6 +162,7 @@ typedef struct
void *callback; void *callback;
void *iosb; void *iosb;
void *arg; void *arg;
obj_handle_t event;
} async_data_t; } async_data_t;
...@@ -4699,6 +4700,6 @@ union generic_reply ...@@ -4699,6 +4700,6 @@ union generic_reply
struct allocate_locally_unique_id_reply allocate_locally_unique_id_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 */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -38,6 +38,7 @@ struct async ...@@ -38,6 +38,7 @@ struct async
struct thread *thread; /* owning thread */ struct thread *thread; /* owning thread */
struct list queue_entry; /* entry in file descriptor queue */ struct list queue_entry; /* entry in file descriptor queue */
struct timeout_user *timeout; struct timeout_user *timeout;
struct event *event;
async_data_t data; /* data for async I/O call */ async_data_t data; /* data for async I/O call */
}; };
...@@ -73,6 +74,7 @@ static void async_destroy( struct object *obj ) ...@@ -73,6 +74,7 @@ static void async_destroy( struct object *obj )
assert( obj->ops == &async_ops ); assert( obj->ops == &async_ops );
if (async->timeout) remove_timeout_user( async->timeout ); if (async->timeout) remove_timeout_user( async->timeout );
if (async->event) release_object( async->event );
release_object( async->thread ); release_object( async->thread );
} }
...@@ -109,11 +111,20 @@ static void async_timeout( void *private ) ...@@ -109,11 +111,20 @@ static void async_timeout( void *private )
struct async *create_async( struct thread *thread, const struct timeval *timeout, struct async *create_async( struct thread *thread, const struct timeval *timeout,
struct list *queue, const async_data_t *data ) 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->thread = (struct thread *)grab_object( thread );
async->event = event;
async->data = *data; async->data = *data;
list_add_tail( queue, &async->queue_entry ); list_add_tail( queue, &async->queue_entry );
...@@ -121,6 +132,7 @@ struct async *create_async( struct thread *thread, const struct timeval *timeout ...@@ -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 ); if (timeout) async->timeout = add_timeout_user( timeout, async_timeout, async );
else async->timeout = NULL; else async->timeout = NULL;
if (event) reset_event( event );
return async; return async;
} }
......
...@@ -178,6 +178,7 @@ typedef struct ...@@ -178,6 +178,7 @@ typedef struct
void *callback; /* client-side callback to call upon end of async */ void *callback; /* client-side callback to call upon end of async */
void *iosb; /* I/O status block in client addr space */ void *iosb; /* I/O status block in client addr space */
void *arg; /* opaque user data to pass to callback */ void *arg; /* opaque user data to pass to callback */
obj_handle_t event; /* event to signal when done */
} async_data_t; } async_data_t;
/* structures for extra message data */ /* structures for extra message data */
......
...@@ -245,7 +245,8 @@ static void dump_apc_result( const apc_result_t *result ) ...@@ -245,7 +245,8 @@ static void dump_apc_result( const apc_result_t *result )
static void dump_async_data( const async_data_t *data ) 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 ) static void dump_luid( const luid_t *luid )
......
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