From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V62lH-0006on-Gt for qemu-devel@nongnu.org; Sun, 04 Aug 2013 14:10:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V62lD-00063H-VI for qemu-devel@nongnu.org; Sun, 04 Aug 2013 14:10:35 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:39026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V62lD-00061x-PV for qemu-devel@nongnu.org; Sun, 04 Aug 2013 14:10:31 -0400 From: Alex Bligh Date: Sun, 4 Aug 2013 19:09:57 +0100 Message-Id: <1375639805-1943-9-git-send-email-alex@alex.org.uk> In-Reply-To: <1375639805-1943-1-git-send-email-alex@alex.org.uk> References: <714109BBB1F743A30290732C@nimrod.local> <1375639805-1943-1-git-send-email-alex@alex.org.uk> Subject: [Qemu-devel] [RFC] [PATCHv5 08/16] aio / timers: Add QEMUTimerListGroup 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 , liu ping fan , Stefan Hajnoczi , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net Add a QEMUTimerListGroup each AioContext (meaning a QEMUTimerList associated with each clock is added) and delete it when the AioContext is freed. Signed-off-by: Alex Bligh --- async.c | 2 ++ include/block/aio.h | 4 ++++ tests/test-aio.c | 3 +++ tests/test-thread-pool.c | 3 +++ 4 files changed, 12 insertions(+) diff --git a/async.c b/async.c index 90fe906..b3512ca 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); + timerlistgroup_deinit(ctx->tlg); } 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); + timerlistgroup_init(ctx->tlg); return ctx; } diff --git a/include/block/aio.h b/include/block/aio.h index 1836793..aea3a97 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -17,6 +17,7 @@ #include "qemu-common.h" #include "qemu/queue.h" #include "qemu/event_notifier.h" +#include "qemu/timer.h" typedef struct BlockDriverAIOCB BlockDriverAIOCB; typedef void BlockDriverCompletionFunc(void *opaque, int ret); @@ -69,6 +70,9 @@ typedef struct AioContext { /* Thread pool for performing work and receiving completion callbacks */ struct ThreadPool *thread_pool; + + /* TimerLists for calling timers - one per clock type */ + QEMUTimerListGroup tlg; } AioContext; /* Returns 1 if there are still outstanding AIO requests; 0 otherwise */ diff --git a/tests/test-aio.c b/tests/test-aio.c index c173870..2d7ec4c 100644 --- a/tests/test-aio.c +++ b/tests/test-aio.c @@ -12,6 +12,7 @@ #include #include "block/aio.h" +#include "qemu/timer.h" AioContext *ctx; @@ -628,6 +629,8 @@ int main(int argc, char **argv) { GSource *src; + init_clocks(); + ctx = aio_context_new(); src = aio_get_g_source(ctx); g_source_attach(src, NULL); diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c index b62338f..27d6190 100644 --- a/tests/test-thread-pool.c +++ b/tests/test-thread-pool.c @@ -3,6 +3,7 @@ #include "block/aio.h" #include "block/thread-pool.h" #include "block/block.h" +#include "qemu/timer.h" static AioContext *ctx; static ThreadPool *pool; @@ -205,6 +206,8 @@ int main(int argc, char **argv) { int ret; + init_clocks(); + ctx = aio_context_new(); pool = aio_get_thread_pool(ctx); -- 1.7.9.5