Joerg-Cyril.Hoehle@t-systems.com writes:
What happened every so often, even on a single-core machine(!), is that CreateTimerQueue(dueTime=0=immediate) would see the timer thread created and the callback invoked before the function returns. Since This->started was not set yet, our callback would return immediately, in effect causing sound to start only one 10ms period later. That's obviously was not intended by the author. So let's set This->started before CTQ.
This doesn't make sense, there's a critical section.
Since This->started was not set yet[...]
This doesn't make sense, there's a critical section.
You are right, this one patch is only needed for my lock-less code, which I'll not submit for now. Good catch.
(The minimal dueTime would benefit current code nevertheless, since critical section contention still requires the magnificient Linux scheduler to perform two more context switches until everything is ready. I've yet to write down the summary of my lock-contention tests. The result is not pretty, and my lock-less code significantly reduced underruns in mmdevapi/render/test_worst_case (aka. XA2 test).)
Regards, Jörg Höhle