
22 Dec
2009
22 Dec
'09
1:04 p.m.
Helge Bahmann wrote:
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); ... }
It can, this is one of the motivating examples for atomic_thread_fence. :-)