This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: basic_string atomicity
On Thu, Jan 5, 2012 at 5:00 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> I'm not sure what the memory ordering requirements are for
>> std::string, I think decrementing the count to zero needs to
>> synchronise with deallocating the memory, but I'm not sure about
>> increments.
>
> I think decrementing the refcount in _M_dispose() should be acq_rel,
> but as you suggested the increment in _M_ref_copy only needs to be
> acquire. I think. ?Check that with an expert though, I'm not
> confident!
Yes, it seems like _M_ref_copy only needs ACQUIRE, but _M_dispose
needs RELEASE, which means that dispose should use a distinct
interface.
- David