http://bugs.winehq.org/show_bug.cgi?id=3930
--- Comment #37 from Jörg Höhle hoehle@users.sourceforge.net 2010-03-03 11:21:08 --- I instrumented the MIDI tests in the git tree to use callbacks (it's trivial to do, the code is already there, just trace(GetCurrentProcessId)) and went for a surprise.
Both w2k and XP execute all callbacks on the caller's thread! There a single exception: midiStreamOut's MOM_DONE is called in the context of some other thread.
This is especially surprising for MOM_POSITIONCB as one would assume that this one is invoked asynchronously to the main application which is busy doing something else. The only mechanism that comes to mind that would allow this is QueueUserAPC, i.e. the asynchronous procedure call mechanism. OTOH it means that if the app never calls Wait(), the APC never executes.
W98SE on WineTestBot executes all callbacks from a thread unique across all tests (i.e. it's not started anew with every midiOpen), different from the caller's. Is this a system-wide MIDI player thread or one solely dedicated to executing user callbacks?
OTOH Wine executes MOM_OPEN and MOM_CLOSE on the caller's thread like w2k and XP, but MOM_DONE and MOM_POSITIONCB from the player thread.