On Mon, 16 Sep 2013 18:34:17 -0600
Burkhard Ritter <burkhard(a)ualberta.ca> wrote:
My understanding now is that: 1. Atomicity
(meaning atomic read and write) in and by itself is not enough. I also
need to ensure that memory access does not get reordered across my
atomic reads and writes (so that, for example, I don't happen to
increase the write counter before the data is actually written to the
buffer). 2. To ensure atomicity and to enforce these memory barriers I
always need some (cpu/architecture specific) special instructions.
Hi,
For atomic read/writes, barriers, and other atomic operations,
cpu-specific instructions are not needed anymore. You can use generic
gcc builtins:
http://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Atomic-Builtins.html
-Alexandre.