This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fw: [patch] Make std::tr1::shared_ptr thread-safe.


On Fri, Apr 01, 2005 at 05:58:17PM +0200, Paolo Carlini wrote:

> Peter Dimov wrote:
> 
> > Robert's suggestion, if I understand correctly, is to use a mutex for
> > all operations, including counting (what boost::shared_ptr currently
> > does on non-Windows platforms). This is guaranteed to be safe, but may
> > generate some bad publicity, as the recent c.l.c++.m thread has shown.
> 
> Frankly, I don't care much about "publicity" and such (at least in this
> specific case ;) We are talking about our *first* experimental delivery
> of shared_ptr. It's only a starting point, we are all humbly learning
> about *many* different topics in this area, *nothing* more.
> 
> > However, if __exchange_and_add is reviewed and found/changed to be
> > fully-fenced, this will automatically take care of all memory
> > visibility issues in shared_ptr as well.
> 
> Very nice. And a review is needed *anyway*: nobody did it, until today,
> to my best knowledge.

As requested, this is my first patch with the addition of empty critical
sections to ensure a consistent view of the ref count.

Tested x86_64-unknown-linux-gnu mainline, testing 4.0 now,
also tested against the modified Boost tests.

jon


Attachment: libstdcxx-shared_ptr_mutex.2.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]