Boost logo

Boost :

Subject: Re: [boost] storing intrusive_ptr in atomic?!
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2013-10-25 05:30:00

On Fri, Oct 25, 2013 at 8:35 AM, Oliver Kowalke <oliver.kowalke_at_[hidden]>wrote:

> 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

-- gpd

Boost list run by bdawes at, gregod at, cpdaniel at, john at