[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC] [PATCHv3 05/12] aio / timers: Add a clock to AioConte
From: |
Alex Bligh |
Subject: |
[Qemu-devel] [RFC] [PATCHv3 05/12] aio / timers: Add a clock to AioContext |
Date: |
Thu, 25 Jul 2013 23:16: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
Re: [Qemu-devel] [PATCHv2] [RFC 0/7] aio / timers: Add AioContext timers and use ppoll, Stefan Hajnoczi, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 00/12] aio / timers: Add AioContext timers and use ppoll, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 02/12] aio / timers: add ppoll support with qemu_poll_ns, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 03/12] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 04/12] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 06/12] aio / timers: Add an AioContext pointer to QEMUClock, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 05/12] aio / timers: Add a clock to AioContext,
Alex Bligh <=
- [Qemu-devel] [RFC] [PATCHv3 01/12] aio / timers: add qemu-timer.c utility functions, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 07/12] aio / timers: aio_ctx_prepare sets timeout from AioContext timers, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 08/12] aio / timers: Convert aio_poll to use AioContext timers' deadline, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 10/12] aio / timers: on timer modification, qemu_notify or aio_notify, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 09/12] aio / timers: convert mainloop to use timeout, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 12/12] aio / timers: Add test harness for AioContext timers, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv3 11/12] aio / timers: Remove alarm timers, Alex Bligh, 2013/07/25
- Re: [Qemu-devel] [RFC] [PATCHv3 00/12] aio / timers: Add AioContext timers and use ppoll, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv4 00/13] aio / timers: Add AioContext timers and use ppoll, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 03/13] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack, Alex Bligh, 2013/07/26