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

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

 



On Sat, Oct 18, 2008 at 10:56:31PM +0200, Paul Davis wrote:

> 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?

The only way to know is to verify all the possible cases in
jack_ringbuffer_write_space() and jack_ringbuffer_read_space(),
taking into account that the masking operation may not have
been applied at the time these are called, and that 'the other'
*_ptr could be >= size.

Note that this is *much* simpler in the C++ class that
I poster earlier - there are no conditions at all in
write_avail() or read_avail(). The essential difference
is that I don't mask the stored values of _nrd and _nwr
(the equivalents of read_ptr and write_ptr). This also
removes the ambiguity between an empty and full buffer.
The downside is that it depends on the user code acting
in the correct way (which seems reasonable).

Ciao,

-- 
FA

Laboratorio di Acustica ed Elettroacustica
Parma, Italia

Lascia la spina, cogli la rosa.

_______________________________________________
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