Boost logo

Boost Users :

Subject: [Boost-users] [Smart pointers] BOOST_SP_HAS_SYNC undefined on ARM
From: Vaclav Barta (vbar_at_[hidden])
Date: 2013-03-14 03:07:13


Hi,

I've been looking at some traces of our Android app (which is mostly
native and extensively uses boost) and was surprised to find it uses
spinlocks around the reference count of boost::shared_ptr. So I've
checked the boost sources and found
boost/smart_ptr/detail/atomic_count.hpp choosing the implementation
depending on platform and other #defines, of which BOOST_SP_HAS_SYNC
sounded like it should be turned on (Google recommends using gcc
__sync_* intrinsics on Android). But,
boost/smart_ptr/detail/sp_has_sync.hpp requires either
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 (which the Google cross-compiler
apparently doesn't have), or (for recent gcc)

#define BOOST_SP_HAS_SYNC

#if defined( __arm__ ) || defined( __armel__ )
#undef BOOST_SP_HAS_SYNC
#endif

Why not use the intrinsics on ARM? Are they broken? For all ARM
variants, or just some (ideally some old ones - I cound ignore them
then)? Or are the intrinsics' semantics incompatible with the way boost
atomic count needs?

     Bye
         Vasek

--
http://www.mangrove.cz/

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net