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

Peter Dimov pdimov@mmltd.net
Wed Mar 30 18:57:00 GMT 2005


Jakub Jelinek wrote:
> Even as an interim solution it sounds wrong.  The lock has been added
> to this method only, so it would only protect from concurent
> add_ref_lock calls.  But _M_use_count is changed in a bunch of other
> methods as well, so either you use atomic instructions everywhere, or
> you use (the same) lock everywhere, but mixing that just can't work.

It is correct, to the best of my knowledge. This is Tyson Whitehead's 
CASless modification of the original CASful algorithm by Alexander Terekhov.

http://lists.boost.org/MailArchives/boost/msg66868.php



More information about the Libstdc++ mailing list