From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0bYa-0003ze-MW for qemu-devel@nongnu.org; Sat, 20 Jul 2013 14:07:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V0bYX-00083I-Lr for qemu-devel@nongnu.org; Sat, 20 Jul 2013 14:07:00 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:48362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0bYX-00082v-G5 for qemu-devel@nongnu.org; Sat, 20 Jul 2013 14:06:57 -0400 From: Alex Bligh Date: Sat, 20 Jul 2013 19:06:41 +0100 Message-Id: <1374343603-29183-6-git-send-email-alex@alex.org.uk> In-Reply-To: <1374343603-29183-1-git-send-email-alex@alex.org.uk> References: <1E8E204.8000201@redhat.com> <1374343603-29183-1-git-send-email-alex@alex.org.uk> Subject: [Qemu-devel] [PATCHv2] [RFC 5/7] aio / timers: Add a clock to AioContext List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Alex Bligh , Stefan Hajnoczi , Paolo Bonzini , rth@twiddle.net Add a clock to each AioContext and delete it when freed. Signed-off-by: Alex Bligh --- 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