From: Jerry Lawson (Jerry.Lawson_at_[hidden])
Date: 2007-01-11 12:26:41
On sparc/gcc environment, boost/detail/sp_counted_base.hpp will use
sp_counted_base_pt.hpp, which of course implements counter protection via
pthread_mutex operations. Other gcc-environments (x86, x64, ia64, ppc) have
the concept of using asm directives for atomic increment & decrement, which
obviously is more efficient than the mutex operations.
The boost/detail/atomic_count_gcc.hpp implementation seems like a more
efficient mechanism for incrementing/decrementing the shared_ptr reference
counters. In fact, the shared_ptr_nmt.hpp implementation does use
boost::detail::atomic_count for the reference count (albeit directly, rather
than through the shared_count template).
I am using atomic_count as the basis for my internal reference counting for
my intrusive_ptr-based objects and am happy with this.
So I'm curious as to why sp_counted_base.hpp does not use the atomic
increment/decrement model for sparc/gcc that it does for other gcc
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk