Skip to contentSkip to conversation

Prevent disk data loss when closing qemu

PATCH Paolo Bonzini 2 participants 2 messages May 24, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Paolo Bonzini

author Reviewed-by
#1 lore raw

Il 24/05/2012 09:42, Pavel Dovgaluk ha scritto:

Quoted 14 lines

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

---
 os-win32.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
os-win32.c +0 -0
index ad76370..66c39b8 100644
@@ -57,7 +57,11 @@ int setenv(const char *name, const char *value, int overwrite)
 

os-win32.c int setenv(const char *name, const char *value, int overwrite) · line 66

Quoted 10 lines
os-win32.c +5 -1
 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;
 }

Anthony, can you queue it for 1.1?

Paolo

#2 lore raw
Quoted 28 lines · Paolo Bonzini

Il 24/05/2012 09:42, Pavel Dovgaluk ha scritto:

Quoted 14 lines

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

---
  os-win32.c |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)
os-win32.c +0 -0
index ad76370..66c39b8 100644
@@ -57,7 +57,11 @@ int setenv(const char *name, const char *value, int overwrite)
 

os-win32.c int setenv(const char *name, const char *value, int overwrite) · line 66

Quoted 10 lines
os-win32.c +5 -1
  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;
  }
Quoted 1 line

Anthony, can you queue it for 1.1?

Is that a 10 second sleep? I really think this needs a much, much better commit message. Random sleeps like this are poison and need to be carefully justified.

Regards,

Anthony Liguori

Quoted 3 lines

Paolo