[PATCH 2/2] winmm: Make midiStream* messages asynchronous to avoid dead-locks.

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Wed Feb 8 03:59:18 CST 2012


This can fix #26697 and a few other bugs where apps hang when
they use midiStream* from inside FUNCTION callbacks.
I can't remember whether bug #3930 is affected by midiStream, midiOut or waveOut callbacks.

Since patch 1/2 it is safe to make midiStream* not wait for ack because the entire
communication is message based, unlike the MCI that uses a status variable.

Apps like to call midiStreamOut from within a MHDR_DONE callback.
This patch allows midiStreamSuspend/Resume/Stop to be called within such a callback.

As apps also use midiStreamClose from within such a callback, I've included
a FIXME so people are warned. The patch then leaks the player structure,
allowing Close to succeed, which is what the apps expect.

The patch also fixes the Thread handle leak as well as a sort of race condition that can occur
because DriverCallback was called while lpMidiStrm->lpMidiHdr was inconsistent.

In summary, DriverCallback DCB_FUNCTION is not perfect yet, but
it supports many more MIDI scenarios than before.

 Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-winmm-Make-midiStream-messages-asynchronous-to-avo.patch
Type: application/octet-stream
Size: 5450 bytes
Desc: 0002-winmm-Make-midiStream-messages-asynchronous-to-avo.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120208/53b46dfc/attachment.obj>

More information about the wine-patches mailing list