El 08/08/2014 14:58, Peter Dimov escribió:
The problem with the current implementation is not the lack of a hardware memory barrier, but the lack of a compiler memory barrier. On GCC, it's __asm__ __volatile__ ( "" ::: "memory" ). For release semantics, it ought to go before the store.
Thanks. That might be the case in many other platforms provided by users (AIX, OSF on Alpha) where the atomic write is implemented without any barrier.
Nowadays on GCC it might be best to use the built-in atomic intrinsics:
https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/_005f_005fatomic-Builtins.html
std::atomic would be even better but I don't think it works in C++03 mode.
Interprocess supports quite old GCCs (from 4.0, I think) that might not have atomic builtins. I expect Boost.Atomic to provide assembler code for those platforms. Best, Ion