dinput: [2/2] Create/destroy hook thread from DirectInput [try 3].

Alexandre Julliard julliard at winehq.org
Mon Sep 11 10:40:26 CDT 2006


Vitaliy Margolen <wine-patch at kievinfo.com> writes:

> +static void release_hook_thread(void)
> +{
> +    LONG ref;
> +
> +    EnterCriticalSection(&dinput_hook_crit);
> +    ref = --hook_thread_refcount;
> +    TRACE("Releasing to %ld\n", ref);
> +    if (ref == 0) SendMessageW(hook_thread_hwnd, WM_DESTROY, 0, 0);

WM_DESTROY is supposed to be sent by DestroyWindow, sending it
manually is not very nice, you should use a WM_USER message
instead. Also you need to clear hook_thread_hwnd first, otherwise
there's a race since you don't wait for the thread to finish.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list