summaryrefslogtreecommitdiff
path: root/qemu-timer.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2010-03-19 11:30:35 +0100
committerAurelien Jarno <aurelien@aurel32.net>2010-03-27 14:05:07 +0100
commitca5a2a4b12bd44762a5106c9352eafd878bbd52f (patch)
treec4b9ed0f3cc33fc258df8d6e83d891cd7a4184df /qemu-timer.c
parent06b611c48edb1bf0301c3e7fe49dec2b9feaaf89 (diff)
fix race between timer firing vs. alarm_timer->pending = 0
The period for Win32 timers is very short and always the same independent of dynticks, so it's possible that the timer fires before qemu_run_all_timers has reset alarm_timer->pending to zero. Reset alarm_timer->pending before rearming. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'qemu-timer.c')
-rw-r--r--qemu-timer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/qemu-timer.c b/qemu-timer.c
index 329d3a4e6..49eac86c5 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -706,14 +706,14 @@ void configure_icount(const char *option)
void qemu_run_all_timers(void)
{
+ alarm_timer->pending = 0;
+
/* rearm timer, if not periodic */
if (alarm_timer->expired) {
alarm_timer->expired = 0;
qemu_rearm_alarm_timer(alarm_timer);
}
- alarm_timer->pending = 0;
-
/* vm time timers */
if (vm_running) {
qemu_run_timers(vm_clock);