|
Boost : |
Subject: Re: [boost] Using Boost.Atomic for shared_ptr
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-12-22 08:04:07
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. :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk