[Winmm/winealsa] Don't use asynchronous callbacks in dsound any
tom at dbservice.com
Sun Dec 24 16:16:28 CST 2006
Maarten Lankhorst wrote:
> 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
Correct me if I'm wrong, but doesn't your code create and destroy the
thread in ::Play() and ::Stop()? It would be better to destroy it
together with the DirectSoundBuffer object (whether you create the
thread when the object is created or the first time ::Play() is called
is not so important, but I've been told the CreateFrame() overhead is
big so that we should try to minimize its use). but I would suggect to
create teh thread when the DSB object is created, as the CreateThread()
in ::Play() may have side-effects (delay in the sound etc).
More information about the wine-devel