boost_shared_ptr.h: Use __atomic_add_dispatch and __exchange_and_add_dispatch everywhere.

2006-09-28  Paolo Carlini  <pcarlini@suse.de>

	* include/tr1/boost_shared_ptr.h: Use __atomic_add_dispatch and
	__exchange_and_add_dispatch everywhere.

From-SVN: r117280
This commit is contained in:
Paolo Carlini 2006-09-28 12:57:47 +00:00 committed by Paolo Carlini
parent 01e0ef5af0
commit 4553813629
2 changed files with 20 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2006-09-28 Paolo Carlini <pcarlini@suse.de>
* include/tr1/boost_shared_ptr.h: Use __atomic_add_dispatch and
__exchange_and_add_dispatch everywhere.
2006-09-27 Benjamin Kosnik <bkoz@redhat.com>
* include/ext/typelist.h (type_to_type): Remove.

View File

@ -109,7 +109,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
: public _Mutex_base<_Lp>
{
public:
_Sp_counted_base() : _M_use_count(1), _M_weak_count(1) { }
_Sp_counted_base()
: _M_use_count(1), _M_weak_count(1) { }
virtual
~_Sp_counted_base() // nothrow
@ -130,7 +131,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
void
_M_add_ref_copy()
{ __gnu_cxx::__atomic_add(&_M_use_count, 1); }
{ __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
void
_M_add_ref_lock();
@ -138,26 +139,28 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
void
_M_release() // nothrow
{
if (__gnu_cxx::__exchange_and_add(&_M_use_count, -1) == 1)
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count,
-1) == 1)
{
_M_dispose();
#ifdef __GTHREADS
#ifdef __GTHREADS
_GLIBCXX_READ_MEM_BARRIER;
_GLIBCXX_WRITE_MEM_BARRIER;
#endif
if (__gnu_cxx::__exchange_and_add(&_M_weak_count, -1) == 1)
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
-1) == 1)
_M_destroy();
}
}
void
_M_weak_add_ref() // nothrow
{ __gnu_cxx::__atomic_add(&_M_weak_count, 1); }
{ __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
void
_M_weak_release() // nothrow
{
if (__gnu_cxx::__exchange_and_add(&_M_weak_count, -1) == 1)
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
{
#ifdef __GTHREADS
_GLIBCXX_READ_MEM_BARRIER;
@ -184,13 +187,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
_Sp_counted_base<_S_single>::
_M_add_ref_lock()
{
if (__gnu_cxx::__exchange_and_add(&_M_use_count, 1) == 0)
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
}
}
#ifdef __GTHREADS
template<>
inline void
@ -198,7 +201,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
_M_add_ref_lock()
{
__gnu_cxx::__scoped_lock sentry(*this);
if (__gnu_cxx::__exchange_and_add(&_M_use_count, 1) == 0)
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
@ -227,7 +230,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
}
template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
class _Sp_counted_base_impl : public _Sp_counted_base<_Lp>
class _Sp_counted_base_impl
: public _Sp_counted_base<_Lp>
{
public:
/**