[Portaudio] Race Condition in DirectSound

Dan Weber dan at marketsoup.com
Fri Jan 15 11:20:11 EST 2010


Hey guys,

As Dmitry correctly pointed out, there is a weakness in the DirectSound
StopStream function.  It uses sleep to synchronize on the callback
completion.  In my case, my framesPerBuffer size is so small that this
does not give enough time before it kills the timer, effectively killing
the timer while still processing the callback.

A solution to solve this would be to use a condition wait variable and
block on that between the two threads, allowing one more full iteration
to happen before fully stopping.  This is a make or break issue for my
application, so if there is any one who is interested in fixing this who
understands threading primitives on windows, I am willing to pay to have
this fixed within reason.

Thanks,
Dan



More information about the Portaudio mailing list