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

This commit is contained in:
Alexandre Julliard 2007-03-21 14:27:52 +01:00
parent 31ade1eb67
commit fa4679fea6
4 changed files with 19 additions and 4 deletions

View File

@ -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 */

View File

@ -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;
}

View File

@ -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 */

View File

@ -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 )