
25 Oct
2013
25 Oct
'13
10:50 a.m.
2013/10/25 Giovanni Piero Deretta
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.
the intention behind my question was an algorithm for work-stealing/sharing using atomic-ops.