
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.hp...
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.