From 8adce7765a55e356e6dddd672f312ef9c6acdd5c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 21 Mar 2007 14:28:23 +0100 Subject: [PATCH] server: Notify the async object when the APC call completed. --- server/async.c | 17 +++++++++++++++++ server/file.h | 1 + server/thread.c | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/server/async.c b/server/async.c index bc5893af3f..2d8018a0f7 100644 --- a/server/async.c +++ b/server/async.c @@ -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 ) { diff --git a/server/file.h b/server/file.h index ae98cf15bb..de5bf3ad23 100644 --- a/server/file.h +++ b/server/file.h @@ -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 ); diff --git a/server/thread.c b/server/thread.c index 6323110ef5..dfa7411045 100644 --- a/server/thread.c +++ b/server/thread.c @@ -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 ); -- 2.32.0.93.g670b81a890