basic_string atomicity
David Edelsohn
dje.gcc@gmail.com
Thu Jan 5 20:17:00 GMT 2012
On Thu, Jan 5, 2012 at 3:01 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> With the addition of C++11 memory model, this builtin now performs
>> heavy-weight, full barrier SEQUENTIAL CONSISTENCY semantics.
>
> I thought the __sync builtins were always full barriers too?
The description was not that precise, and they were not always
implemented as SEQUENTIAL CONSISTENCY.
>> What memory model is required? It seems like the context for the code
>> expects something closer to ACQUIRE semantics.
>>
>> I opened a GCC Bugzilla about the change in __sync_fetch_and_xxx
>> semantics, but it appears that libstdc++ internally should use the new
>> __atomic_fetch_add() builtin with more precise semantic intentions.
>
> Yes, eventually. Similarly for shared_ptr.
What consistency model does libstdc++ require? __sync_fetch_and_xxx
has become more heavy-weight and even the earlier memory model
probably was unnecessarily expensive for its usage in libstdc++ based
on our analysis for POWER.
Thanks, David
More information about the Libstdc++
mailing list