mirror of git://gcc.gnu.org/git/gcc.git
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:
parent
01e0ef5af0
commit
4553813629
|
|
@ -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>
|
2006-09-27 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* include/ext/typelist.h (type_to_type): Remove.
|
* include/ext/typelist.h (type_to_type): Remove.
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
|
||||||
: public _Mutex_base<_Lp>
|
: public _Mutex_base<_Lp>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
_Sp_counted_base() : _M_use_count(1), _M_weak_count(1) { }
|
_Sp_counted_base()
|
||||||
|
: _M_use_count(1), _M_weak_count(1) { }
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
~_Sp_counted_base() // nothrow
|
~_Sp_counted_base() // nothrow
|
||||||
|
|
@ -130,7 +131,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
|
||||||
|
|
||||||
void
|
void
|
||||||
_M_add_ref_copy()
|
_M_add_ref_copy()
|
||||||
{ __gnu_cxx::__atomic_add(&_M_use_count, 1); }
|
{ __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
|
||||||
|
|
||||||
void
|
void
|
||||||
_M_add_ref_lock();
|
_M_add_ref_lock();
|
||||||
|
|
@ -138,26 +139,28 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
|
||||||
void
|
void
|
||||||
_M_release() // nothrow
|
_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();
|
_M_dispose();
|
||||||
#ifdef __GTHREADS
|
#ifdef __GTHREADS
|
||||||
_GLIBCXX_READ_MEM_BARRIER;
|
_GLIBCXX_READ_MEM_BARRIER;
|
||||||
_GLIBCXX_WRITE_MEM_BARRIER;
|
_GLIBCXX_WRITE_MEM_BARRIER;
|
||||||
#endif
|
#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();
|
_M_destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_M_weak_add_ref() // nothrow
|
_M_weak_add_ref() // nothrow
|
||||||
{ __gnu_cxx::__atomic_add(&_M_weak_count, 1); }
|
{ __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
|
||||||
|
|
||||||
void
|
void
|
||||||
_M_weak_release() // nothrow
|
_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
|
#ifdef __GTHREADS
|
||||||
_GLIBCXX_READ_MEM_BARRIER;
|
_GLIBCXX_READ_MEM_BARRIER;
|
||||||
|
|
@ -184,13 +187,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
|
||||||
_Sp_counted_base<_S_single>::
|
_Sp_counted_base<_S_single>::
|
||||||
_M_add_ref_lock()
|
_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;
|
_M_use_count = 0;
|
||||||
__throw_bad_weak_ptr();
|
__throw_bad_weak_ptr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __GTHREADS
|
#ifdef __GTHREADS
|
||||||
template<>
|
template<>
|
||||||
inline void
|
inline void
|
||||||
|
|
@ -198,7 +201,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
|
||||||
_M_add_ref_lock()
|
_M_add_ref_lock()
|
||||||
{
|
{
|
||||||
__gnu_cxx::__scoped_lock sentry(*this);
|
__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;
|
_M_use_count = 0;
|
||||||
__throw_bad_weak_ptr();
|
__throw_bad_weak_ptr();
|
||||||
|
|
@ -227,7 +230,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
|
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:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue