Module: wine Branch: master Commit: 8adce7765a55e356e6dddd672f312ef9c6acdd5c URL: http://source.winehq.org/git/wine.git/?a=commit;h=8adce7765a55e356e6dddd672f...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Mar 21 14:28:23 2007 +0100
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(+), 0 deletions(-)
diff --git a/server/async.c b/server/async.c index bc5893a..2d8018a 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 ae98cf1..de5bf3a 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 6323110..dfa7411 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 );