
22 Dec
2009
22 Dec
'09
7:42 a.m.
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