From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2Tr2-0007oA-ND for qemu-devel@nongnu.org; Thu, 25 Jul 2013 18:17:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2Tr0-0006S9-W2 for qemu-devel@nongnu.org; Thu, 25 Jul 2013 18:17:48 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:45010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2Tr0-0006Rf-Gn for qemu-devel@nongnu.org; Thu, 25 Jul 2013 18:17:46 -0400 From: Alex Bligh Date: Thu, 25 Jul 2013 23:16:41 +0100 Message-Id: <1374790608-7518-6-git-send-email-alex@alex.org.uk> In-Reply-To: <1374790608-7518-1-git-send-email-alex@alex.org.uk> References: <20130725093713.GG21033@stefanha-thinkpad.redhat.com> <1374790608-7518-1-git-send-email-alex@alex.org.uk> Subject: [Qemu-devel] [RFC] [PATCHv3 05/12] 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