Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-01-11 14:50:20


I wrote:

>> The primitives supplied by g++ were not enough to support
>> sp_counted_base (although this is going to change in 4.2, I
>> think).

It seems that 4.1 supports the atomics as well,

http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html

so we'll be able to take advantage of them for 1.35 for all g++ targets.

Jerry Lawson wrote:

> Thanks for the response. I will patch my boost with those files.
>
> Just for my education, however, I'd like to understand what was
> missing from the gcc primitives that you needed for the
> sp_counted_base required implementation?

shared_ptr requires a "compare and swap" operation
(__sync_(bool|val)_compare_and_swap in the page above) in addition to atomic
increment/decrement, and libstdc++ doesn't provide one.

> Furthermore, should it be
> okay for me to continue to use atomic_count_gcc.hpp's pre-increment
> and post-increment overloaded operators as the implementation for my
> specialization of intrusive_ptr_add_ref(T*) and
> intrusive_ptr_add_release(T*) free functions?

You should be OK. I don't remember any reports of a problem with
atomic_count_gcc.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk