Kobi Cohen-Arazi wrote:
Hi
As far as we know, boost::shared_ptr has a locking overhead when inc/dec is invoked.
I wonder: 1. Is it using atomic op?
It depends on the platform.
3. What can we do in order to be able to use shared_ptr without that overhead?
You can #define BOOST_SP_DISABLE_THREADS. http://www.boost.org/libs/smart_ptr/shared_ptr.htm#ThreadSafety
2. Why Alexandrescu policy based shared_ptr was rejected?
A policy-based smart pointer never got to the "formal review" stage. David Held was very close to submitting one and has made a formal review request: http://lists.boost.org/Archives/boost/2005/08/91848.php but I don't remember what happened. Maybe he pulled it. However the Loki version is, I believe, actively maintained. http://loki-lib.sourceforge.net/