server: Notify the async object when the APC call completed.

oldstable
Alexandre Julliard 2007-03-21 14:28:23 +01:00
parent fa4679fea6
commit 8adce7765a
3 changed files with 22 additions and 0 deletions

View File

@ -136,6 +136,23 @@ struct async *create_async( struct thread *thread, const struct timeval *timeout
return async;
}
/* store the result of the client-side async callback */
void async_set_result( struct object *obj, unsigned int status )
{
struct async *async = (struct async *)obj;
if (obj->ops != &async_ops) return; /* in case the client messed up the APC results */
if (status == STATUS_PENDING)
{
/* FIXME: restart the async operation */
}
else
{
if (async->event) set_event( async->event );
}
}
/* terminate the async operation at the head of the queue */
void async_terminate_head( struct list *queue, unsigned int status )
{

View File

@ -124,6 +124,7 @@ extern struct object *create_serial( struct fd *fd, unsigned int options );
/* async I/O functions */
extern struct async *create_async( struct thread *thread, const struct timeval *timeout,
struct list *queue, const async_data_t *data );
extern void async_set_result( struct object *obj, unsigned int status );
extern void async_terminate_head( struct list *queue, unsigned int status );
extern void async_terminate_queue( struct list *queue, unsigned int status );

View File

@ -1246,6 +1246,10 @@ DECL_HANDLER(get_apc)
apc->result.create_thread.handle = handle;
clear_error(); /* ignore errors from the above calls */
}
else if (apc->result.type == APC_ASYNC_IO)
{
if (apc->owner) async_set_result( apc->owner, apc->result.async_io.status );
}
wake_up( &apc->obj, 0 );
close_handle( current->process, req->prev );
release_object( apc );