Instead of using asynchronous callbacks that uses signals, use a seperate thread that can be cancelled, this prevents deadlock issues.
Basically we use snd_pcm_wait() that tells us when enough room is free to commit another buffer, then we commit the previous buffer and make the next buffer ready.
Since snd_pcm_wait() uses poll(), we don't have signals in winealsa any more.
This patch causes a hang in the interactive dsound tests:
bash$ cd wine-0.9.28-cvs-patch/dlls/dsound/tests bash$ WINETEST_INTERACTIVE=1 wine dsound_test.exe.so dsound ... fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly. ds3d.c:655: Test failed: The sound played for 835 ms instead of 1000 ms dsound.c:602: Testing a primary buffer at 48000x8x1 with a secondary buffer at 11025x16x2 ds3d.c:447: Playing 1 second 440Hz tone at 11025x16x2 fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly. fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly. fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly. ds3d.c:655: Test failed: The sound played for 371 ms instead of 1000 ms dsound.c:602: Testing a primary buffer at 48000x8x2 with a secondary buffer at 11025x16x2 ds3d.c:447: Playing 1 second 440Hz tone at 11025x16x2 fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly. fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly. ds3d.c:655: Test failed: The sound played for 834 ms instead of 1000 ms dsound.c:602: Testing a primary buffer at 48000x16x1 with a secondary buffer at 11025x16x2 ds3d.c:447: Playing 1 second 440Hz tone at 11025x16x2 fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly. fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly. ds3d.c:655: Test failed: The sound played for 767 ms instead of 1000 ms dsound.c:602: Testing a primary buffer at 48000x16x2 with a secondary buffer at 11025x16x2 ds3d.c:447: Playing 1 second 440Hz tone at 11025x16x2 fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly. dsound.c:602: Testing a primary buffer at 96000x8x1 with a secondary buffer at 11025x16x2 ds3d.c:447: Playing 1 second 440Hz tone at 11025x16x2 fixme:wave:DBSB_MMAPStart Can't access sound driver's buffer directly.
(then silent hang) kernel 2.6.19 wine 0.9.28 Fedora Core 5, snd_via82xx module