[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 7/9] main-loop: refactor qemu_system_wakeup_request(
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 7/9] main-loop: refactor qemu_system_wakeup_request() |
Date: |
Wed, 20 Feb 2013 09:32:47 -0600 |
Signed-off-by: Anthony Liguori <address@hidden>
---
vl.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/vl.c b/vl.c
index 27b6455..a5805ec 100644
--- a/vl.c
+++ b/vl.c
@@ -1699,7 +1699,6 @@ static QTAILQ_HEAD(reset_handlers, QEMUResetEntry)
reset_handlers =
static int shutdown_signal = -1;
static pid_t shutdown_pid;
static int powerdown_requested;
-static int wakeup_requested;
static NotifierList powerdown_notifiers =
NOTIFIER_LIST_INITIALIZER(powerdown_notifiers);
static NotifierList suspend_notifiers =
@@ -1748,11 +1747,14 @@ static gboolean qemu_reset(gpointer unused)
return FALSE;
}
-static int qemu_wakeup_requested(void)
+static gboolean qemu_wakeup(gpointer unused)
{
- int r = wakeup_requested;
- wakeup_requested = 0;
- return r;
+ pause_all_vcpus();
+ cpu_synchronize_all_states();
+ qemu_system_reset(VMRESET_SILENT);
+ resume_all_vcpus();
+ monitor_protocol_event(QEVENT_WAKEUP, NULL);
+ return FALSE;
}
static int qemu_powerdown_requested(void)
@@ -1862,8 +1864,7 @@ void qemu_system_wakeup_request(WakeupReason reason)
}
runstate_set(RUN_STATE_RUNNING);
notifier_list_notify(&wakeup_notifiers, &reason);
- wakeup_requested = 1;
- qemu_notify_event();
+ g_idle_add(qemu_wakeup, NULL);
}
void qemu_system_wakeup_enable(WakeupReason reason, bool enabled)
@@ -1943,13 +1944,6 @@ void qemu_system_vmstop_request(RunState state)
static void main_loop_junk(void)
{
RunState r;
- if (qemu_wakeup_requested()) {
- pause_all_vcpus();
- cpu_synchronize_all_states();
- qemu_system_reset(VMRESET_SILENT);
- resume_all_vcpus();
- monitor_protocol_event(QEVENT_WAKEUP, NULL);
- }
if (qemu_powerdown_requested()) {
qemu_system_powerdown();
}
--
1.8.0
- [Qemu-devel] [PATCH 3/9] main-loop: refactor qemu_system_suspend_request(), (continued)
[Qemu-devel] [PATCH 6/9] main-loop: refactor qemu_system_reset_request(), Anthony Liguori, 2013/02/20
[Qemu-devel] [PATCH 5/9] main-loop: refactor qemu_system_shutdown_request(), Anthony Liguori, 2013/02/20
[Qemu-devel] [PATCH 8/9] main-loop: refactor qemu_system_powerdown_request, Anthony Liguori, 2013/02/20
[Qemu-devel] [PATCH 7/9] main-loop: refactor qemu_system_wakeup_request(),
Anthony Liguori <=
[Qemu-devel] [PATCH 9/9] main-loop: refactor qemu_system_vmstop_request(), Anthony Liguori, 2013/02/20