[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC] [PATCHv6 04/16] aio / timers: Make qemu_run_timers an
From: |
Alex Bligh |
Subject: |
[Qemu-devel] [RFC] [PATCHv6 04/16] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress |
Date: |
Tue, 6 Aug 2013 10:16:20 +0100 |
Make qemu_run_timers and qemu_run_all_timers return progress
so that aio_poll etc. can determine whether a timer has been
run.
Signed-off-by: Alex Bligh <address@hidden>
---
include/qemu/timer.h | 4 ++--
qemu-timer.c | 18 ++++++++++++------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index f434ecb..a1f2ac8 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -62,8 +62,8 @@ bool qemu_timer_pending(QEMUTimer *ts);
bool qemu_timer_expired(QEMUTimer *timer_head, int64_t current_time);
uint64_t qemu_timer_expire_time_ns(QEMUTimer *ts);
-void qemu_run_timers(QEMUClock *clock);
-void qemu_run_all_timers(void);
+bool qemu_run_timers(QEMUClock *clock);
+bool qemu_run_all_timers(void);
void configure_alarms(char const *opt);
void init_clocks(void);
int init_timer_alarm(void);
diff --git a/qemu-timer.c b/qemu-timer.c
index a8b270f..714bc92 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -451,13 +451,14 @@ bool qemu_timer_expired(QEMUTimer *timer_head, int64_t
current_time)
return qemu_timer_expired_ns(timer_head, current_time * timer_head->scale);
}
-void qemu_run_timers(QEMUClock *clock)
+bool qemu_run_timers(QEMUClock *clock)
{
QEMUTimer *ts;
int64_t current_time;
+ bool progress = false;
if (!clock->enabled)
- return;
+ return progress;
current_time = qemu_get_clock_ns(clock);
for(;;) {
@@ -471,7 +472,9 @@ void qemu_run_timers(QEMUClock *clock)
/* run the callback (the timer list can be modified) */
ts->cb(ts->opaque);
+ progress = true;
}
+ return progress;
}
int64_t qemu_get_clock_ns(QEMUClock *clock)
@@ -526,20 +529,23 @@ uint64_t qemu_timer_expire_time_ns(QEMUTimer *ts)
return qemu_timer_pending(ts) ? ts->expire_time : -1;
}
-void qemu_run_all_timers(void)
+bool qemu_run_all_timers(void)
{
+ bool progress = false;
alarm_timer->pending = false;
/* vm time timers */
- qemu_run_timers(vm_clock);
- qemu_run_timers(rt_clock);
- qemu_run_timers(host_clock);
+ progress |= qemu_run_timers(vm_clock);
+ progress |= qemu_run_timers(rt_clock);
+ progress |= qemu_run_timers(host_clock);
/* rearm timer, if not periodic */
if (alarm_timer->expired) {
alarm_timer->expired = false;
qemu_rearm_alarm_timer(alarm_timer);
}
+
+ return progress;
}
#ifdef _WIN32
--
1.7.9.5
- Re: [Qemu-devel] [RFC] [PATCHv5 06/16] aio / timers: Untangle include files, (continued)
- Re: [Qemu-devel] [RFC] [PATCHv5 06/16] aio / timers: Untangle include files, Alex Bligh, 2013/08/06
- Re: [Qemu-devel] [RFC] [PATCHv5 06/16] aio / timers: Untangle include files, Stefan Hajnoczi, 2013/08/07
- Re: [Qemu-devel] [RFC] [PATCHv5 06/16] aio / timers: Untangle include files, Alex Bligh, 2013/08/07
- Re: [Qemu-devel] [RFC] [PATCHv5 06/16] aio / timers: Untangle include files, Stefan Hajnoczi, 2013/08/08
- [Qemu-devel] [RFC] [PATCHv5 09/16] aio / timers: Add a notify callback to QEMUTimerList, Alex Bligh, 2013/08/04
- [Qemu-devel] [RFC] [PATCHv5 15/16] aio / timers: Remove alarm timers, Alex Bligh, 2013/08/04
- [Qemu-devel] [RFC] [PATCHv5 16/16] aio / timers: Add test harness for AioContext timers, Alex Bligh, 2013/08/04
- [Qemu-devel] [RFC] [PATCHv6 00/16] aio / timers: Add AioContext timers and use ppoll, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv6 04/16] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress,
Alex Bligh <=
- [Qemu-devel] [RFC] [PATCHv6 03/16] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv6 07/16] aio / timers: Add QEMUTimerListGroup and helper functions, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv6 08/16] aio / timers: Add QEMUTimerListGroup to AioContext, Alex Bligh, 2013/08/06
- Re: [Qemu-devel] [RFC] [PATCHv6 08/16] aio / timers: Add QEMUTimerListGroup to AioContext, Stefan Hajnoczi, 2013/08/06
- Re: [Qemu-devel] [RFC] [PATCHv6 08/16] aio / timers: Add QEMUTimerListGroup to AioContext, Alex Bligh, 2013/08/06
- Re: [Qemu-devel] [RFC] [PATCHv6 08/16] aio / timers: Add QEMUTimerListGroup to AioContext, Stefan Hajnoczi, 2013/08/06
- Re: [Qemu-devel] [RFC] [PATCHv6 08/16] aio / timers: Add QEMUTimerListGroup to AioContext, Alex Bligh, 2013/08/06
- Re: [Qemu-devel] [RFC] [PATCHv6 08/16] aio / timers: Add QEMUTimerListGroup to AioContext, Stefan Hajnoczi, 2013/08/07
- [Qemu-devel] [RFC] [PATCHv6 05/16] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList, Alex Bligh, 2013/08/06
- Re: [Qemu-devel] [RFC] [PATCHv6 05/16] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList, Stefan Hajnoczi, 2013/08/06