From: Jinoh Kang jinoh.kang.kr@gmail.com
--- server/async.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/server/async.c b/server/async.c index 4832d69b7bf..1183ea787a0 100644 --- a/server/async.c +++ b/server/async.c @@ -44,6 +44,7 @@ struct async struct fd *fd; /* fd associated with an unqueued async */ struct timeout_user *timeout; unsigned int timeout_status; /* status to report upon timeout */ + unsigned int terminate_status;/* pending termination status, or STATUS_PENDING */ struct event *event; async_data_t data; /* data for async I/O call */ struct iosb *iosb; /* I/O status block */ @@ -165,6 +166,11 @@ void async_terminate( struct async *async, unsigned int status ) { struct iosb *iosb = async->iosb;
+ if (status != STATUS_ALERTED && async->terminate_status == STATUS_PENDING) + { + async->terminate_status = status; + } + if (async->terminated) return;
async->terminated = 1; @@ -268,6 +274,7 @@ struct async *create_async( struct fd *fd, struct thread *thread, const async_da async->queue = NULL; async->fd = (struct fd *)grab_object( fd ); async->initial_status = STATUS_PENDING; + async->terminate_status = STATUS_PENDING; async->signaled = 0; async->pending = 1; async->wait_handle = 0; @@ -491,6 +498,8 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota
assert( async->terminated ); /* it must have been woken up if we get a result */
+ if (status == STATUS_PENDING) status = async->terminate_status; + if (async->unknown_status) async_set_initial_status( async, status );
if (async->alerted && status == STATUS_PENDING) /* restart it */