[alsa-devel] [PATCH] alsa-lib: snd_pcm_delay and friends do not account for a write being currently in progress

James Courtier-Dutton james.dutton at gmail.com
Thu Jun 3 18:34:30 CEST 2010

On 3 June 2010 17:10, John Lindgren <john.lindgren at tds.net> wrote:
> I understand that snd_pcm_delay and snd_pcm_writei currently "interfere
> with each other" in that snd_pcm_delay returns wrong values if called
> during snd_pcm_writei.  That is the problem my patch tries to correct.
> Do you disagree with this improvement?  If so, why?

I disagree because I believe the changes are unnecessary.
The alsa api is big enough already, so adding anything extra must have
an extremely good reason for it.
snd_pcm_writei and snd_pcm_delay were always intended to be used in
the same thread.
Calling snd_pcm_writei and snd_pcm_delay at the same time is
non-deterministic so fairly pointless to do.
Adding more locks just makes another hit on performances so should be avoided.
Locks really kill performance on a multi processor SMP machine.

I would argue that modifying your program to fit in the the above
contraints is the way to go.

More information about the Alsa-devel mailing list