[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [patch 04/14] qemu: explictly rearm alarm timer on main_loo
From: |
mtosatti |
Subject: |
[Qemu-devel] [patch 04/14] qemu: explictly rearm alarm timer on main_loop_wait |
Date: |
Wed, 22 Apr 2009 16:15:08 -0300 |
User-agent: |
quilt/0.46-1 |
- lift notification code out of try_to_rearm_timer/host_alarm_handler
- probably going to remove alarm timers via signals sometime soon anyway
Signed-off-by: Marcelo Tosatti <address@hidden>
Index: trunk/vl.c
===================================================================
--- trunk.orig/vl.c
+++ trunk/vl.c
@@ -1346,9 +1346,6 @@ static void host_alarm_handler(int host_
#ifdef _WIN32
struct qemu_alarm_win32 *data = ((struct
qemu_alarm_timer*)dwUser)->priv;
SetEvent(data->host_alarm);
-#else
- static const char byte = 0;
- write(alarm_timer_wfd, &byte, sizeof(byte));
#endif
alarm_timer->flags |= ALARM_FLAG_EXPIRED;
@@ -1638,27 +1635,13 @@ static void unix_stop_timer(struct qemu_
#endif /* !defined(_WIN32) */
-static void try_to_rearm_timer(void *opaque)
-{
- struct qemu_alarm_timer *t = opaque;
-#ifndef _WIN32
- ssize_t len;
- /* Drain the notify pipe */
- do {
- char buffer[512];
- len = read(alarm_timer_rfd, buffer, sizeof(buffer));
- } while ((len == -1 && errno == EINTR) || len > 0);
-#endif
+#ifdef _WIN32
- if (t->flags & ALARM_FLAG_EXPIRED) {
- alarm_timer->flags &= ~ALARM_FLAG_EXPIRED;
- qemu_rearm_alarm_timer(alarm_timer);
- }
+static void dummy_event_handler(void *opaque)
+{
}
-#ifdef _WIN32
-
static int win32_start_timer(struct qemu_alarm_timer *t)
{
TIMECAPS tc;
@@ -1699,7 +1682,7 @@ static int win32_start_timer(struct qemu
return -1;
}
- qemu_add_wait_object(data->host_alarm, try_to_rearm_timer, t);
+ qemu_add_wait_object(data->host_alarm, dummy_event_handler, t);
return 0;
}
@@ -1782,11 +1765,6 @@ static int init_timer_alarm(void)
goto fail;
}
-#ifndef _WIN32
- qemu_set_fd_handler2(alarm_timer_rfd, NULL,
- try_to_rearm_timer, NULL, t);
-#endif
-
alarm_timer = t;
return 0;
@@ -3778,6 +3756,12 @@ void main_loop_wait(int timeout)
}
#endif
+ /* rearm timer, if not periodic */
+ if (alarm_timer->flags & ALARM_FLAG_EXPIRED) {
+ alarm_timer->flags &= ~ALARM_FLAG_EXPIRED;
+ qemu_rearm_alarm_timer(alarm_timer);
+ }
+
/* vm time timers */
if (vm_running && likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER)))
qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL],
--
- [Qemu-devel] Re: [patch 11/11] qemu: basic kvm iothread support, Anthony Liguori, 2009/04/17
- [Qemu-devel] [patch 00/14] qemu: introduce iothread (v4), mtosatti, 2009/04/22
- [Qemu-devel] [patch 11/14] qemu: use debug_requested global instead of cpu_exec return, mtosatti, 2009/04/22
- [Qemu-devel] [patch 05/14] qemu: factor out special event notification, mtosatti, 2009/04/22
- [Qemu-devel] [patch 08/14] qemu: introduce qemu_cpu_kick, mtosatti, 2009/04/22
- [Qemu-devel] [patch 07/14] qemu: introduce qemu_init_vcpu, mtosatti, 2009/04/22
- [Qemu-devel] [patch 14/14] qemu: introduce iothread, mtosatti, 2009/04/22
- [Qemu-devel] [patch 13/14] qemu: handle stop request in main loop, mtosatti, 2009/04/22
- [Qemu-devel] [patch 04/14] qemu: explictly rearm alarm timer on main_loop_wait,
mtosatti <=
- [Qemu-devel] [patch 12/14] qemu: refactor tcg cpu execution loop, mtosatti, 2009/04/22
- [Qemu-devel] [patch 09/14] qemu: introduce qemu_init_main_loop, mtosatti, 2009/04/22
- [Qemu-devel] [patch 06/14] qemu: refactor main_loop, mtosatti, 2009/04/22
- [Qemu-devel] [patch 10/14] qemu: introduce lock/unlock_iothread, mtosatti, 2009/04/22
- [Qemu-devel] [patch 01/14] qemu: create helper for event notification, mtosatti, 2009/04/22
- [Qemu-devel] [patch 03/14] qemu: per-arch cpu_has_work, mtosatti, 2009/04/22
- [Qemu-devel] [patch 02/14] qemu: mutex/thread/cond wrappers and configure tweaks, mtosatti, 2009/04/22