Boost logo

Boost :

Subject: [boost] [interprocess] atomic_write32 on GCC/x86/x68_64 lacks memory barrier
From: Lars Hagström (lars_at_[hidden])
Date: 2014-08-08 08:28:44


In a piece of legacy code I've had a few uses of the atomic operations
inside Boost.Interprocess (yes, I know they're internal, but I had no other
choice at the time, so sue me :-).
I've been debugging a thread synchronization issue which ended up in me
actually looking for a problem inside interprocess, and I believe that I
found the error.
The atomic_write32 function, when running gcc on intel platforms does not
have a memory barrier, which causes my threads to not see changes that they
should see.

A little bit of googling gave me the following link,
which discusses exactly this issue.

I've now fixed my code to use Boost.Atomic instead of relying on boost
interprocess internals, so I'm good, but I worry that the issue might
affect boost.interprocess as well.

So I propose that atomic_write32 should be implemented using atomic_cas32.
Or indeed that Boost.Atomic should be used instead, which is more work,



Boost list run by bdawes at, gregod at, cpdaniel at, john at