C++11 atomic library notes

Andrew MacLeod amacleod@redhat.com
Sun Oct 2 13:56:00 GMT 2011

> On Sat, 1 Oct 2011, Andrew MacLeod wrote:
> Ah ok, I had understood:
> * if __atomic_store_8 is inlined on line 18, it should also be inlined 
> on line 42
> when instead it is:
> * we can't have a locked addition and a lock-free subtraction (hence 
> the __atomic_is_lock_free which only takes a size as argument)
> Makes perfect sense, thank you for the precision.

I Added another line in the document to clarify this, thanks.

> By the way, does it make sense to work atomically on a 16 byte object, 
> and also work atomically on its first 8 bytes, thus potentially 
> requiring __atomic_is_lock_free not to depend on the size?
not really...  working on the first 8 bytes of the 16 byte atomic object 
'breaks' the atomicity of the 16 byte object.   Volatility of the object 
is the only thing that *may* impact this, AFAICT.


More information about the Gcc mailing list