http://bugs.winehq.org/show_bug.cgi?id=29531
--- Comment #5 from Jörg Höhle hoehle@users.sourceforge.net 2012-01-23 08:18:37 CST --- Bug #29585, comment #3 is more appropriate here. Another improvement to winealsa and wineoss design is to split the use of the critical section This->lock: a) One prevents several app threads from calling the API concurrently. b) The second one shall prevent the internal callback from operating on the slots that Get/ReleaseBuffer modify concurrently.
It is not good that bombarding the API with ReleaseBuffer(0) or GetCurrentPadding blocks the audio callback. Instead of an internal lock, we should investigate the opportunity for a lock-less design. Then, the kernel would never put the callback to sleep in EnterCriticalSection. What kernel expert knows how much later a thread recovers from such a sleep?
The ancient ALSA player never used EnterCS except perhaps when logging, or with SetEvent, or when receiving a message for which there existed a specific CS wwo->msgRing.msg_crst http://source.winehq.org/source//dlls/winealsa.drv/waveout.c?v=wine-1.3.24