[2/3] wineboot: Terminate processes immediately after WM_ENDSESSION.

Vincent Povirk madewokherd+8cd9 at gmail.com
Thu Dec 10 13:42:39 CST 2009

On Thu, Dec 10, 2009 at 1:20 PM, Juan Lang <juan.lang at gmail.com> wrote:
> Hi Vincent,
> -    /* wait for app to quit on its own for a while */
> -    ret = WaitForSingleObject( process_handle, PROCQUIT_TIMEOUT );
> +    /* Check whether the app quit on its own */
> +    ret = WaitForSingleObject( process_handle, 0 );
>     CloseHandle( process_handle );
>     if (ret == WAIT_TIMEOUT)
> I'm confused why you removed the timeout.  The documented behavior[1,
> 2] is to wait a short timeout, show a dialog if the app hasn't quit by
> then, then kill it.  This change makes wineboot terminate a process
> immediately.  Is this really necessary to fix the bug?  I'd expect
> that you want to handle the WAIT_OBJECT_0 case in addition to the
> WAIT_TIMEOUT case, and leave the timeout alone.
> --Juan
> [1] http://blogs.msdn.com/michen/archive/2008/04/04/Application-termination-when-user-logs-off.aspx
> [2] http://blogs.msdn.com/oldnewthing/archive/2008/04/21/8413175.aspx

Yes, this is really necessary, and it's how Windows does it. I've
tested it, and it's documented, by the posts you've linked in fact.

The timeout mentioned in [1] is in waiting for WM_ENDSESSION to
return. This wait and timeout is handled by
send_messages_with_timeout_dialog. However, once that message has
returned, the process has done all the cleanup it needs and should be
terminated. Since Windows terminates processes immediately after
WM_ENDSESSION returns, there's no reason to believe the app will ever
close itself and no reason to wait before killing it.

Vincent Povirk

More information about the wine-devel mailing list