/* notifies client thread of new status of its async request */ void async_terminate( struct async *async, unsigned int status ) { assert( status != STATUS_PENDING ); if (async->status != STATUS_PENDING) { /* already terminated, just update status */ async->status = status; return; } async->status = status; if (async->data.callback) { apc_call_t data; memset( &data, 0, sizeof(data) ); data.type = APC_ASYNC_IO; data.async_io.func = async->data.callback; data.async_io.user = async->data.arg; data.async_io.sb = async->data.iosb; data.async_io.status = status; thread_queue_apc( async->thread, &async->obj, &data ); } else async_set_result( &async->obj, STATUS_SUCCESS, 0, 0, 0 ); async_reselect( async ); release_object( async ); /* so that it gets destroyed when the async is done */ }
static void async_destroy( struct object *obj ) { struct async *async = (struct async *)obj; assert( obj->ops == &async_ops ); list_remove( &async->queue_entry ); async_reselect( async ); if (async->timeout) remove_timeout_user( async->timeout ); if (async->event) release_object( async->event ); release_object( async->queue ); release_object( async->thread ); }
static void async_destroy( struct object *obj ) { struct async *async = (struct async *)obj; assert( obj->ops == &async_ops ); list_remove( &async->process_entry ); if (async->queue) { list_remove( &async->queue_entry ); async_reselect( async ); } else if (async->fd) release_object( async->fd ); if (async->timeout) remove_timeout_user( async->timeout ); if (async->completion) release_object( async->completion ); if (async->event) release_object( async->event ); if (async->iosb) release_object( async->iosb ); release_object( async->thread ); }