@@ -177,6 +177,7 @@ aio_ctx_finalize(GSource *source)
aio_set_event_notifier(ctx, &ctx->notifier, NULL, NULL);
event_notifier_cleanup(&ctx->notifier);
g_array_free(ctx->pollfds, TRUE);
+ qemu_free_clock(ctx->clock);
}
static GSourceFuncs aio_source_funcs = {
@@ -215,6 +216,7 @@ AioContext *aio_context_new(void)
aio_set_event_notifier(ctx, &ctx->notifier,
(EventNotifierHandler *)
event_notifier_test_and_clear, NULL);
+ ctx->clock = qemu_new_clock(QEMU_CLOCK_REALTIME);
return ctx;
}
@@ -41,6 +41,8 @@ typedef struct AioHandler AioHandler;
typedef void QEMUBHFunc(void *opaque);
typedef void IOHandler(void *opaque);
+typedef struct QEMUClock QEMUClock;
+
typedef struct AioContext {
GSource source;
@@ -69,6 +71,9 @@ typedef struct AioContext {
/* Thread pool for performing work and receiving completion callbacks */
struct ThreadPool *thread_pool;
+
+ /* Clock for calling timers */
+ QEMUClock *clock;
} AioContext;
/* Returns 1 if there are still outstanding AIO requests; 0 otherwise */
Add a clock to each AioContext and delete it when freed. Signed-off-by: Alex Bligh <alex@alex.org.uk> --- async.c | 2 ++ include/block/aio.h | 5 +++++ 2 files changed, 7 insertions(+)