On Sat, Oct 18, 2008 at 06:46:00PM +0200, Paul Davis wrote:
> I don't believe this logic is correct.
It doesn't matter how many times it is read, but it
does matter if it is ever written with a wrong value.
And this *did* happen in the old version at the end of
rb->read_ptr += n1;
rb->read_ptr &= rb->size_mask;
If a context switch occurs after the first statement,
and read_ptr > size (which can happen), then the writer
would believe there is more space to write than there
Same at the other end: an incomplete update of write_ptr
(the addition is executed but not yet the mask) could make
the reader believe there is more to read than there actually
Laboratorio di Acustica ed Elettroacustica
Lascia la spina, cogli la rosa.
Linux-audio-user mailing list