aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-02-09 18:55:51 -0800
committerChris Robinson <[email protected]>2014-02-09 18:55:51 -0800
commit29e0af5ef052a3602f9b7935d6002c6d2ae5e8cb (patch)
treed4cc169949c2c989f03b720bf6b9af70a9924e05 /Alc
parent09d1319e82cfa73975041f9a5343b8b8c0e8029a (diff)
Fix a race condition in the mmdevapi message queue thread
Diffstat (limited to 'Alc')
-rw-r--r--Alc/backends/mmdevapi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index 32c4d7ef..b93ff667 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -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);