Okay, I think I found a safe answer for multiple producers
incrementing in the ring buffer.

Each producer will do a type __sync_fetch_and_add (type *ptr, type
value) operation which is guaranteed to be atomic and thus thread
safe, on multiple core machines sharing a common memory.  The fetch
operation will return the current value of the variable and then
increment it atomically.

Thus a safely incrementing modulo counter to the ring buffer is
maintained and my problem is solved.

Randall
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to