[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/42] aio / timers: Add QEMUTimerListGroup to AioCon
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 19/42] aio / timers: Add QEMUTimerListGroup to AioContext |
Date: |
Thu, 22 Aug 2013 22:11:15 +0200 |
From: Alex Bligh <address@hidden>
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 <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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 9791d8e..cd4a489 100644
--- a/async.c
+++ b/async.c
@@ -205,6 +205,7 @@ aio_ctx_finalize(GSource *source)
event_notifier_cleanup(&ctx->notifier);
qemu_mutex_destroy(&ctx->bh_lock);
g_array_free(ctx->pollfds, TRUE);
+ timerlistgroup_deinit(&ctx->tlg);
}
static GSourceFuncs aio_source_funcs = {
@@ -244,6 +245,7 @@ AioContext *aio_context_new(void)
aio_set_event_notifier(ctx, &ctx->notifier,
(EventNotifierHandler *)
event_notifier_test_and_clear);
+ timerlistgroup_init(&ctx->tlg);
return ctx;
}
diff --git a/include/block/aio.h b/include/block/aio.h
index 1e3ed1c..06f3aad 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -19,6 +19,7 @@
#include "qemu/queue.h"
#include "qemu/event_notifier.h"
#include "qemu/thread.h"
+#include "qemu/timer.h"
typedef struct BlockDriverAIOCB BlockDriverAIOCB;
typedef void BlockDriverCompletionFunc(void *opaque, int ret);
@@ -73,6 +74,9 @@ 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;
};
/**
diff --git a/tests/test-aio.c b/tests/test-aio.c
index 1ab5637..e1f394b 100644
--- a/tests/test-aio.c
+++ b/tests/test-aio.c
@@ -12,6 +12,7 @@
#include <glib.h>
#include "block/aio.h"
+#include "qemu/timer.h"
AioContext *ctx;
@@ -630,6 +631,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 8188d1a..c1f8e13 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.8.3.1
- [Qemu-devel] [PULL 10/42] aio / timers: Rename qemu_new_clock and expose clock types, (continued)
- [Qemu-devel] [PULL 10/42] aio / timers: Rename qemu_new_clock and expose clock types, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 09/42] aio / timers: Rename qemu_timer_* functions, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 11/42] aio / timers: add qemu-timer.c utility functions, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 13/42] aio / timers: add ppoll support with qemu_poll_ns, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 12/42] aio / timers: Consistent treatment of disabled clocks for deadlines, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 14/42] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 15/42] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 16/42] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 17/42] aio / timers: Untangle include files, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 18/42] aio / timers: Add QEMUTimerListGroup and helper functions, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 19/42] aio / timers: Add QEMUTimerListGroup to AioContext,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 20/42] aio / timers: Add a notify callback to QEMUTimerList, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 21/42] aio / timers: aio_ctx_prepare sets timeout from AioContext timers, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 22/42] aio / timers: Add aio_timer_init & aio_timer_new wrappers, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 23/42] aio / timers: Convert aio_poll to use AioContext timers' deadline, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 24/42] aio / timers: Convert mainloop to use timeout, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 25/42] aio / timers: On timer modification, qemu_notify or aio_notify, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 27/42] aio / timers: Use all timerlists in icount warp calculations, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 26/42] aio / timers: Introduce new API timer_new and friends, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 28/42] aio / timers: Add documentation and new format calls, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 36/42] aio / timers: Add test harness for AioContext timers, Stefan Hajnoczi, 2013/08/22