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

Peter Dimov pdimov@mmltd.net
Wed Mar 30 21:39:00 GMT 2005


Paolo Carlini wrote:
> Jonathan, for the configury bits (please accept in advance my excuses
> if my suggestions are obvious), I think we should have something very
> similar to the allocator bits ([GLIBCXX_ENABLE_ALLOCATOR], mt vs new)
> : just go through the various available compare_and_swap and select
> the compare_and_swap way as default for such targets, otherwise, for
> all the other targets, the solution using empty critical sections as
> per Alexander and Peter messages.

Apologies for repeating myself, but this is an important point: the empty 
critical sections fix a different problem (memory visibility). The 
compare_and_swap way is not a substitute for them. It eliminates the 
non-empty critical section in add_ref_lock, nothing more. 



More information about the Libstdc++ mailing list