This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++11 atomic library notes


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.

Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]