Check for the RUN_STATE_SUSPENDED state instead. Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com> --- vl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/vl.c b/vl.c index 2d828c8..43c696d 100644 --- a/vl.c +++ b/vl.c @@ -1292,7 +1292,6 @@ static pid_t shutdown_pid; static int powerdown_requested; static int debug_requested; static int suspend_requested; -static bool is_suspended; static NotifierList suspend_notifiers = NOTIFIER_LIST_INITIALIZER(suspend_notifiers); static NotifierList wakeup_notifiers = @@ -1426,12 +1425,11 @@ static void qemu_system_suspend(void) notifier_list_notify(&suspend_notifiers, NULL); runstate_set(RUN_STATE_SUSPENDED); monitor_protocol_event(QEVENT_SUSPEND, NULL); - is_suspended = true; } void qemu_system_suspend_request(void) { - if (is_suspended) { + if (runstate_check(RUN_STATE_SUSPENDED)) { return; } suspend_requested = 1; @@ -1446,7 +1444,7 @@ void qemu_register_suspend_notifier(Notifier *notifier) void qemu_system_wakeup_request(WakeupReason reason) { - if (!is_suspended) { + if (!runstate_check(RUN_STATE_SUSPENDED)) { return; } if (!(wakeup_reason_mask & (1 << reason))) { @@ -1457,7 +1455,6 @@ void qemu_system_wakeup_request(WakeupReason reason) notifier_list_notify(&wakeup_notifiers, &reason); reset_requested = 1; qemu_notify_event(); - is_suspended = false; } void qemu_system_wakeup_enable(WakeupReason reason, bool enabled) -- 1.7.9.2.384.g4a92a