[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/9] main-loop: refactor qemu_system_suspend_request
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 3/9] main-loop: refactor qemu_system_suspend_request() |
Date: |
Wed, 20 Feb 2013 09:32:43 -0600 |
Signed-off-by: Anthony Liguori <address@hidden>
---
vl.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/vl.c b/vl.c
index a305fed..705c7f1 100644
--- a/vl.c
+++ b/vl.c
@@ -1700,7 +1700,6 @@ static int reset_requested;
static int shutdown_requested, shutdown_signal = -1;
static pid_t shutdown_pid;
static int powerdown_requested;
-static int suspend_requested;
static int wakeup_requested;
static NotifierList powerdown_notifiers =
NOTIFIER_LIST_INITIALIZER(powerdown_notifiers);
@@ -1751,13 +1750,6 @@ static int qemu_reset_requested(void)
return r;
}
-static int qemu_suspend_requested(void)
-{
- int r = suspend_requested;
- suspend_requested = 0;
- return r;
-}
-
static int qemu_wakeup_requested(void)
{
int r = wakeup_requested;
@@ -1840,12 +1832,13 @@ void qemu_system_reset_request(void)
qemu_notify_event();
}
-static void qemu_system_suspend(void)
+static gboolean qemu_system_suspend(gpointer unused)
{
pause_all_vcpus();
notifier_list_notify(&suspend_notifiers, NULL);
runstate_set(RUN_STATE_SUSPENDED);
monitor_protocol_event(QEVENT_SUSPEND, NULL);
+ return FALSE;
}
void qemu_system_suspend_request(void)
@@ -1853,9 +1846,8 @@ void qemu_system_suspend_request(void)
if (runstate_check(RUN_STATE_SUSPENDED)) {
return;
}
- suspend_requested = 1;
cpu_stop_current();
- qemu_notify_event();
+ g_idle_add(qemu_system_suspend, NULL);
}
void qemu_register_suspend_notifier(Notifier *notifier)
@@ -1942,9 +1934,6 @@ void qemu_system_vmstop_request(RunState state)
static void main_loop_junk(void)
{
RunState r;
- if (qemu_suspend_requested()) {
- qemu_system_suspend();
- }
if (qemu_shutdown_requested()) {
qemu_kill_report();
monitor_protocol_event(QEVENT_SHUTDOWN, NULL);
--
1.8.0
[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, 2013/02/20