$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Using Boost.Atomic for shared_ptr
From: Helge Bahmann (hcb_at_[hidden])
Date: 2009-12-22 02:42:16
On Mon, 21 Dec 2009, Peter Dimov wrote:
> Relaxed is fine for add_ref. The decrements need to be acqrel.
> use_count() needs acquire.
I think that decrement can be:
if (use_count_.fetch_sub(1, memory_order_release)==1) {
atomic_thread_fence(memory_order_acquire);
...
}
i.e. save the acquire unless the object is going to be deleted.
Helge