qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Pavel Dovgaluk" <Pavel.Dovgaluk@ispras.ru>
To: 'qemu-devel' <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH v2] Prevent disk data loss when closing qemu
Date: Thu, 24 May 2012 11:42:08 +0400	[thread overview]
Message-ID: <002901cd3980$b8d4e6d0$2a7eb470$@Dovgaluk@ispras.ru> (raw)

Prevent disk data loss when closing qemu console window
under Windows 7.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
---
 os-win32.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/os-win32.c b/os-win32.c
index ad76370..66c39b8 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -57,7 +57,11 @@ int setenv(const char *name, const char *value, int overwrite)
 
 static BOOL WINAPI qemu_ctrl_handler(DWORD type)
 {
-    exit(STATUS_CONTROL_C_EXIT);
+    qemu_system_shutdown_request();
+    /* Windows 7 kills application when the function returns.
+       Sleep here to give QEMU a try for closing */
+    Sleep(10000);
+
     return TRUE;
 }

             reply	other threads:[~2012-05-24  7:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24  7:42 Pavel Dovgaluk [this message]
2012-05-24 12:49 ` [Qemu-devel] [PATCH v2] Prevent disk data loss when closing qemu Andreas Färber
2012-05-24 13:46   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002901cd3980$b8d4e6d0$2a7eb470$@Dovgaluk@ispras.ru' \
    --to=pavel.dovgaluk@ispras.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).