[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC] [PATCHv3 06/12] aio / timers: Add an AioContext point
From: |
Alex Bligh |
Subject: |
[Qemu-devel] [RFC] [PATCHv3 06/12] aio / timers: Add an AioContext pointer to QEMUClock |
Date: |
Thu, 25 Jul 2013 23:16:42 +0100 |
Add an AioContext pointer to QEMUClock so it knows what to notify
on a timer change.
Signed-off-by: Alex Bligh <address@hidden>
---
async.c | 1 +
include/qemu/timer.h | 3 +++
qemu-timer.c | 12 ++++++++++++
3 files changed, 16 insertions(+)
diff --git a/async.c b/async.c
index 0d41431..2968c68 100644
--- a/async.c
+++ b/async.c
@@ -217,6 +217,7 @@ AioContext *aio_context_new(void)
(EventNotifierHandler *)
event_notifier_test_and_clear, NULL);
ctx->clock = qemu_new_clock(QEMU_CLOCK_REALTIME);
+ qemu_clock_set_ctx(ctx->clock, ctx);
return ctx;
}
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index a1f2ac8..29817ab 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -16,6 +16,7 @@
#define QEMU_CLOCK_HOST 2
typedef struct QEMUClock QEMUClock;
+typedef struct AioContext AioContext;
typedef void QEMUTimerCB(void *opaque);
/* The real time clock should be used only for stuff which does not
@@ -38,6 +39,8 @@ extern QEMUClock *host_clock;
QEMUClock *qemu_new_clock(int type);
void qemu_free_clock(QEMUClock *clock);
+AioContext *qemu_clock_get_ctx(QEMUClock *clock);
+void qemu_clock_set_ctx(QEMUClock *clock, AioContext * ctx);
int64_t qemu_get_clock_ns(QEMUClock *clock);
int64_t qemu_clock_has_timers(QEMUClock *clock);
int64_t qemu_clock_expired(QEMUClock *clock);
diff --git a/qemu-timer.c b/qemu-timer.c
index 714bc92..6efd1b4 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -29,6 +29,7 @@
#include "hw/hw.h"
#include "qemu/timer.h"
+#include "block/aio.h"
#ifdef CONFIG_POSIX
#include <pthread.h>
#endif
@@ -50,6 +51,7 @@
struct QEMUClock {
QEMUTimer *active_timers;
+ AioContext *ctx;
NotifierList reset_notifiers;
int64_t last;
@@ -252,6 +254,16 @@ void qemu_free_clock(QEMUClock *clock)
g_free(clock);
}
+AioContext *qemu_clock_get_ctx(QEMUClock *clock)
+{
+ return clock->ctx;
+}
+
+void qemu_clock_set_ctx(QEMUClock *clock, AioContext * ctx)
+{
+ clock->ctx = ctx;
+}
+
void qemu_clock_enable(QEMUClock *clock, bool enabled)
{
bool old = clock->enabled;
--
1.7.9.5
- Re: [Qemu-devel] [PATCHv2] [RFC 1/7] aio / timers: Remove alarm timers, (continued)
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 <=
- [Qemu-devel] [RFC] [PATCHv3 05/12] aio / timers: Add a clock to AioContext, Alex Bligh, 2013/07/25
- [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