Boost logo

Boost :

Subject: Re: [boost] atomic_count::operator++ return type
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-04-10 20:15:07


JOAQUIN M. LOPEZ MUÑOZ:
> I'm afraid I don't quite get what you mean exactly by memory visibility in
> this context: I guess I need the same behavior (mutatis mutandis) as given
> by op--. In case it sheds some light, the usage case I talk about can be
> taken a a look at
>
> https://svn.boost.org/trac/boost/browser/trunk/boost/flyweight/refcounted.hpp
>
> The protocol is a classical refcounting mechanism with a twist due to the
> possiblity that values are retrieved even if their recount drops to zero.

I'm not sure how this works... what is TrackingEntry? How do you handle the
possibility of

- thread A detaches the last reference, calls erase, erase calls
check_erase, gets true, and is preempted;

- thread B attaches a reference;

- thread A resumes and deletes the object.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk