qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCHv2] [RFC 5/7] aio / timers: Add a clock to AioContext


From: Alex Bligh
Subject: [Qemu-devel] [PATCHv2] [RFC 5/7] aio / timers: Add a clock to AioContext
Date: Sat, 20 Jul 2013 19:06:41 +0100

Add a clock to each AioContext and delete it when freed.

Signed-off-by: Alex Bligh <address@hidden>
---
 async.c             |    2 ++
 include/block/aio.h |    5 +++++
 2 files changed, 7 insertions(+)

diff --git a/async.c b/async.c
index 90fe906..0d41431 100644
--- a/async.c
+++ b/async.c
@@ -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;
 }
diff --git a/include/block/aio.h b/include/block/aio.h
index 1836793..0835a4d 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -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 */
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]