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
a read:
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
actually is.
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
is.
Ciao,
--
FA
Laboratorio di Acustica ed Elettroacustica
Parma, Italia
Lascia la spina, cogli la rosa.
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
LINUX® is a registered trademark of Linus Torvalds in the USA and other countries.
Linuxaudio.org logo copyright Thorsten Wilms © 2006.
Hosting provided by the Virginia Tech Department of Music and DISIS.