On Fri, 2008-10-17 at 08:56 -0400, Paul Coccoli wrote:
> Why do you suspect you need memory barriers? My concern with
this is the core of the "idea" of the thread-safe ringbuffer.
step back. answer the question. what *does* happen?
it means that the read_ptr has an unnecessarily high value, which means
that we *under*-estimate the space available for writing.. ditto for the
write_ptr case, where we *under*-estimate the data available for
reading.
we can and *do* anticipate that context switches will occur there -
there is no general way to that execute that operation
(increment-and-mask) in a lock-free atomic way. the idea is that even if
it does happen, the resulting error prevents the buffer from being
misused. of course, its a little inefficient. but until we get cpu's
with atomic inc-and-mask instructions, its the price we pay for going
lock-free (and its a relatively small cost).
--p
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
LINUX® is a registered trademark of Linus Torvalds in the USA and other countries.
Linuxaudio.org logo copyright Thorsten Wilms © 2006.
Hosting provided by the Virginia Tech Department of Music and DISIS.