[Winmm/winealsa] Don't use asynchronous callbacks in dsound any more

Eric Pouech eric.pouech at wanadoo.fr
Tue Dec 26 14:21:23 CST 2006

Maarten Lankhorst a écrit :
> 2006/12/25, Eric Pouech <eric.pouech at wanadoo.fr>:
>> Maarten,
>> nice work on Alsa (which is definitively needed !!)
>> a couple of comments:
>> - I know the winmm code (and drivers) is crippled by bad synchronisation
>> tricks (like cleaning a field in a structure to signal a thread). This
>> is bad (TM). So I'd suggest using here a real synchronisation object.
> Well, what I have now works well enough, thread is sure to be killed,
> which makes life easier. I don't see the point in making code more
> complicated then it needs to be.
the compiler may just optimize things away, and there's no guarantee 
that NULL:ing a handle in a struct share across threads will always do 
what you want. For the sake of record, some of the others place do mark 
the field as volatile to make things a bit more clearer.
>> - I wonder if it's a good idea to create another thread for this... but
>> before merging all existing drivers' threads into a single one, I'd
>> suggest using the fd oriented functions & poll (see
>> snd_pcm_poll_descriptors and friends) instead of snd_pcm_wait, that'll
>> ease up the future work.
> I'm not sure if it's a good thing either to create a new thread for
> it, but in the current driver model there are no other alternatives,
> you are right it is easy enough to use poll(), but basically all I
> would be doing is copy the code from snd_pcm_wait(), which does it for
> me. If anyone wants to use poll() it is easy enough to copy the code
> 1:1 from the LGPL alsa sound library. However I saw no need for it and
> to keep the code simple I just used snd_pcm_wait.
> See alsa-lib/src/pcm/pcm.c for how snd_pcm_wait is implemented: It
> just uses poll()
I know, that's why I'm asking you to do it ;-)

More information about the wine-devel mailing list