Jörg-Cyril Höhle
Email: <you AT SPAMFREE example DOT com>
Elements of a talk on concurrency issues in audio applications
Proposed for WineConf2010
What's typically missing from documentation?
- Thread-safety, reentrancy properties
- What method is called at what time (internally)?
- Where's timing described?
- Generate tick messages at what rate?
- Fill buffers (how large?) at what rate?
How long does a function take to execute and how does it influence code?
Nasty timing examples
PlaySound(...,SND_ASYNC) - apps may hang for a couple of seconds while trying to draw menus.
Quartz -Morrowind stucks for 3-5 seconds during background music change (in combat) #14186.
MCI Stop - Heroes of Might and Magic II "freezes for a few seconds every time the track changes."
"Under Windows, I used to apply the IgnoreMCIStop fix from the Windows Application Compatibility Toolkit to fix the problem.": IgnoreMCIStop DelayWinMMCallback
Dirty callbacks - HOMM bug #3930 MSDN says "... as doing so can cause a deadlock".
midiOutUnprepare + HeapFree are called from within the MOM_DONE function callback.
midiStreamClose is called from the MOM_DONE callback.
Asynchronous Notification - In Chip's Challenge #22880 the MCI player sent DONE notification before setting MCI_MODE_STOP. This fails in Wine when executed too early (would work in native).
Where's robust code?
How to safely implement concurrency, e.g. Pause/Stop command while playing?
- Program to the UNIX or MS-Windows APIs?
Ring buffer (as in winealsa.drv) is frowned upon? Gimme Erlang!
Critical Section is no silver bullet. It raises more problems than it solves.
Exit CS + Wait + Enter CS is critical: anything can happen in between.
Events & WaitForObject* too - WaitForObject(threadobject) waits until it dies!
