[PATCH 03/10] winmm: Implement waveOut* on top of MMDevAPI

Alexandre Julliard julliard at winehq.org
Tue Jul 5 08:58:49 CDT 2011


Andrew Eikum <aeikum at codeweavers.com> writes:

> +static MMRESULT WINMM_SendDeviceThreadMessage(UINT msg, WPARAM wp)
> +{
> +    DWORD wait;
> +    MMRESULT res;
> +
> +    EnterCriticalSection(&g_devthread_lock);
> +
> +    if(!PostThreadMessageW(g_devthread_id, msg, wp, (DWORD_PTR)&res)){
> +        ERR("PostThreadMessage failed: %d\n", GetLastError());
> +        LeaveCriticalSection(&g_devthread_lock);
> +        return MMSYSERR_ERROR;
> +    }
> +
> +    wait = WaitForSingleObject(g_devthread_evt, INFINITE);
> +
> +    LeaveCriticalSection(&g_devthread_lock);

If you are going to wait for a reply it would be better to create a
HWND_MESSAGE window and do a SendMessage to it, then you get all the
synchronization for free.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list