Re: [LAU] Simple, easy multithreaded circular buffer library for Linux?

From: Paul Davis <paul@email-addr-hidden>
Date: Sat Oct 18 2008 - 23:56:31 EEST

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?

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
Received on Sun Oct 19 00:15:04 2008

This archive was generated by hypermail 2.1.8 : Sun Oct 19 2008 - 00:15:04 EEST