Robert Reif reif@earthlink.net writes:
Fix CreateThread/waveOutOpen race by forcing parent thread to sleep which allows background thread to run and block before waveOutOpen is called.
If the background thread has to run for things to work, you need to add a real synchronisation mechanism. A Sleep is not fixing anything, it's just making the race condition less likely.