basic_string atomicity
David Edelsohn
dje.gcc@gmail.com
Thu Jan 5 22:13:00 GMT 2012
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
More information about the Libstdc++
mailing list