From: Eric Niebler (eric_at_[hidden])
Date: 2006-04-14 14:56:37
I'm thinking about replacing some uses of shared_ptr with intrusive_ptr,
but I've got questions. One of the nice things about shared_ptr is the
lock-free thread-safe ref counting. I want my intrusive_ptr to have the
same safety and efficiency, but I don't see how to get it. I see
$boost_root/detail/atomic_count.hpp, but shared_ptr doesn't use it. Why
not? And why is it in detail/? Should I not consider using it?
Taking in the bigger picture, intrusive_ptr requires people to write
their own add_ref and release functions, most of which will probably end
up using ++ and -- on a plain integer. This is totally broken in
multi-threaded applications, right? Isn't it dangerous to not provide
complementary utilities for correctly managing reference counts? It
seems to me intrusive_ptr is impossible to use safely and portably. What
have I missed?
-- Eric Niebler Boost Consulting www.boost-consulting.com