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

From: Fons Adriaensen <fons@email-addr-hidden>
Date: Sun Oct 19 2008 - 00:30:06 EEST

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@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
Received on Sun Oct 19 04:15:02 2008

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