On Tue, Sep 17, 2013 at 2:25 AM, Alexandre DENIS
<contact(a)alexandredenis.net> wrote:
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.
Hi Alexandre,
what I meant was that somewhere along the compiler chain cpu-specific
instructions need to be generated. I think glib provides the
functionality. I didn't know about the GCC builtins you mention, but
it looks to me like they are superseded by C++11's atomic types [1].
When I originally started looking into atomicity I thought it would be
enough to use a (architecture specific) data type size which would be
written and read atomically. However, that's not correct. (Also,
initially I wasn't aware I need some sort of memory barrier.)
Cheers,
Burkhard
[1]
http://www.cplusplus.com/reference/atomic/atomic/