Fix a race condition in the mmdevapi message queue thread

This commit is contained in:
Chris Robinson 2014-02-09 18:55:51 -08:00
parent 09d1319e82
commit 29e0af5ef0

View File

@ -600,6 +600,12 @@ static DWORD CALLBACK MMDevApiMsgProc(void *ptr)
CoUninitialize();
/* HACK: Force Windows to create a message queue for this thread before
* returning success, otherwise PostThreadMessage may fail if it gets
* called before GetMessage.
*/
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
TRACE("Message thread initialization complete\n");
req->result = S_OK;
SetEvent(req->FinishedEvt);