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

Fons Adriaensen fons at kokkinizita.net
Fri Oct 17 15:55:43 EDT 2008


On Fri, Oct 17, 2008 at 09:26:45PM +0200, Joern Nettingsmeier wrote:

> i see. but what about the other scenario:
> thread A reads read_ptr.
> thread B runs and increments it.
> thread A increases the old (wrong) read_ptr value by one and writes a
> wrong value.
> 
> isn't that a problem here?

This can't happen. For both read_ptr and write_ptr
only *one* of the two sides will ever modify it.
That is really the basic idea behind all this.
The other side just reads it, and will never read
a value that could trigger an error.

side.

Ciao,

-- 
FA

Laboratorio di Acustica ed Elettroacustica
Parma, Italia

Lascia la spina, cogli la rosa.




More information about the Linux-audio-user mailing list