Re: [PATCH virt-viewer] win32: process message queue in debug-helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 23, 2013 at 08:10:36PM +0100, Marc-André Lureau wrote:
> Avoid the spice-x from hanging in WaitForInputIdle(), although the
> client itself might not be ready, not even started...

If I understand things correctly, this patch makes sure we still process
Windows messages while waiting for pi.hProcess to be signalled, otherwise
this will interact badly if an activex launches the debug-helper process?
If I understood this correctly, ACK, adding something like this to the
commit log may make sense as imo this makes things clearer.

Christophe

> 
> https://bugzilla.redhat.com/show_bug.cgi?id=903190
> ---
>  src/debug-helper.c | 16 ++++++++++++++--
>  1 file 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);
> -- 
> 1.8.1.rc1.17.g75ed918
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/virt-tools-list

Attachment: pgp6cCbx29RX6.pgp
Description: PGP signature

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux