Merge r4081, closes #1126.

Originally committed to SVN as r4082.
This commit is contained in:
Niels Martin Hansen 2010-02-05 13:22:43 +00:00
parent 8d5cde185d
commit fe65749623

View file

@ -683,9 +683,20 @@ DirectSoundPlayer2Thread::DirectSoundPlayer2Thread(AudioProvider *provider, int
if (!thread_handle)
throw _T("Failed creating playback thread in DirectSoundPlayer2. This is bad.");
CheckError();
HANDLE running_or_error[] = { thread_running, error_happened };
switch (WaitForMultipleObjects(2, running_or_error, FALSE, INFINITE))
{
case WAIT_OBJECT_0:
// running, all good
return;
WaitForSingleObject(thread_running, INFINITE);
case WAIT_OBJECT_0 + 1:
// error happened, we fail
throw error_message;
default:
throw _T("Failed wait for thread start or thread error in DirectSoundPlayer2. This is bad.");
}
}