This is the mail archive of the
mailing list for the libstdc++ project.
Re: basic_string atomicity
On Thu, Jan 5, 2012 at 3:01 PM, Jonathan Wakely <email@example.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.