On 02/08/2012 10:23 AM, Jonathan Wakely wrote:
On 8 February 2012 13:06, Andrew MacLeod<amacl...@redhat.com> wrote:
Yes, I meant to do that last week, but instead it's this week :-P Gerald
had pinged me about it a while ago.
Great, thanks - I was thinking about adding a line to the C++11
improvements in the libstdc++ section mentioning the new
implementation of<atomic>, do you think it's worth it?
Sure. the biggest difference is that we can now compile any arbitrary
class as atomic. Previously it had to be an integer type of the correct
size to map to one of the __sync calls.
Now we can compile any arbitrary user POD as atomic, and if it's size
maps to a supported lock free built-in type, we will issue lock free
code for it.
If it does not, it is left as a library call. Although GCC 4.7 does not
include an atomic library with it, I have made a sample library file
available on the wiki which can be compiled and linked with code to
resolve the calls using a locked implementation. It is in the 'External
Atomics Library' section of http://gcc.gnu.org/wiki/Atomic/GCCMM
Andrew