On Sat, 2008-10-18 at 20:44 +0200, Fons Adriaensen wrote:
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.
if read_ptr > size then the math should result in the write space being
*under* estimated. if thats not happening then my worst nightmares come
true, which has happened before. is there a signed/unsigned issue going
on here?