summaryrefslogtreecommitdiffstats
path: root/src/debug-helper.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-23 19:59:13 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-02-11 16:54:01 +0100
commitd5229a71eb66a94e104fe681f487b438e11c7277 (patch)
treec7b31d6083106b42b787ebc3c554f6ea463d70b5 /src/debug-helper.c
parentea6c9d26736479e66cad31ca8b8d52014c8fc8ac (diff)
downloadvirt-viewer-d5229a71eb66a94e104fe681f487b438e11c7277.tar.gz
virt-viewer-d5229a71eb66a94e104fe681f487b438e11c7277.tar.xz
virt-viewer-d5229a71eb66a94e104fe681f487b438e11c7277.zip
win32: process message queue in debug-helper
Process messages while waiting for pi.hProcess. Avoid the spice-x from hanging in WaitForInputIdle(), although the client itself might not be ready, not even started... https://bugzilla.redhat.com/show_bug.cgi?id=903190
Diffstat (limited to 'src/debug-helper.c')
-rw-r--r--src/debug-helper.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/debug-helper.c b/src/debug-helper.c
index 0a9a923..01909da 100644
--- a/src/debug-helper.c
+++ b/src/debug-helper.c
@@ -24,6 +24,7 @@ int
main(int argc, char *argv[])
{
char pipe[2048];
+ MSG msg;
STARTUPINFO si = { 0, };
PROCESS_INFORMATION pi = { 0, };
gchar *program_path = get_program_path();
@@ -55,8 +56,19 @@ main(int argc, char *argv[])
goto end;
}
- // Wait until child process exits
- WaitForSingleObject(pi.hProcess, INFINITE);
+
+ while (1) {
+ DWORD reason = MsgWaitForMultipleObjects(1, &pi.hProcess, FALSE,
+ INFINITE, QS_ALLINPUT);
+ if (reason == WAIT_OBJECT_0)
+ break;
+ else {
+ if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ }
// Close process and thread handles
CloseHandle(pi.hProcess);