
25 Oct
2013
25 Oct
'13
9:30 a.m.
On Fri, Oct 25, 2013 at 8:35 AM, Oliver Kowalke
Hello,
do you confirm that it is valid to store a intrusive_ptr inside an atomic?!
The details of the safety of putting an intrusive_ptr in an atomic are discussed elsethread, I just wanted to remind you here that, unless you rely on exotic deferred reclamation techniques, to safely concurrently update a shared pointer normally you need to manipulate both the pointer itself and the shared count. This means either a DCAS, transactional memory or a (spin) lock. As the former two are implemented by no or few mainstream architectures, you pretty much need a lock. That's the path taken by boost::shared_ptr for example. -- gpd