Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> --- vl.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/vl.c b/vl.c index a5805ec..39b2a5c 100644 --- a/vl.c +++ b/vl.c @@ -1698,7 +1698,6 @@ static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = QTAILQ_HEAD_INITIALIZER(reset_handlers); static int shutdown_signal = -1; static pid_t shutdown_pid; -static int powerdown_requested; static NotifierList powerdown_notifiers = NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); static NotifierList suspend_notifiers = @@ -1757,13 +1756,6 @@ static gboolean qemu_wakeup(gpointer unused) return FALSE; } -static int qemu_powerdown_requested(void) -{ - int r = powerdown_requested; - powerdown_requested = 0; - return r; -} - /* We use RUN_STATE_MAX but any invalid value will do */ static bool qemu_vmstop_requested(RunState *r) { @@ -1907,16 +1899,16 @@ void qemu_system_shutdown_request(void) g_idle_add(qemu_system_shutdown, NULL); } -static void qemu_system_powerdown(void) +static gboolean qemu_system_powerdown(gpointer unused) { monitor_protocol_event(QEVENT_POWERDOWN, NULL); notifier_list_notify(&powerdown_notifiers, NULL); + return FALSE; } void qemu_system_powerdown_request(void) { - powerdown_requested = 1; - qemu_notify_event(); + g_idle_add(qemu_system_powerdown, NULL); } void qemu_register_powerdown_notifier(Notifier *notifier) @@ -1944,9 +1936,6 @@ void qemu_system_vmstop_request(RunState state) static void main_loop_junk(void) { RunState r; - if (qemu_powerdown_requested()) { - qemu_system_powerdown(); - } if (qemu_vmstop_requested(&r)) { vm_stop(r); } -- 1.8.0