On Sun, Oct 19, 2008 at 12:24 AM, Jack O'Quin <jack.oquin(a)gmail.com> wrote:
On Sat, Oct 18, 2008 at 10:45 PM, Paul Coccoli
<pcoccoli(a)gmail.com> wrote:
On Sat, Oct 18, 2008 at 11:29 PM, Jack O'Quin
<jack.oquin(a)gmail.com> wrote:
This is wrong. For the single reader, single
writer case, atomic operations
are *not* necessary. The bug, as was already pointed out, is due to storing
Let's agree to disagree, then. Single-reader, single-writer does not
automatically make something SMP safe. There is large body of
literature on lock-free data structures that agrees with me; someone
posted a link to a collection of those earlier in the thread.
Let's not. This is not just a matter of opinion. If you read that literature,
you will find that the ring buffer *is* safe for the single reader,
single writer
case. In many other SMP situations, atomic operations *are* required,
but not for ring buffers.
The only time you can get away without atomic ops is on uni-processor.
Please cite a reference that says otherwise.
Notice that all the fixes proposed all involve removing the "+=" and
using only assignment.