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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux