diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-10 10:46:27 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-10 10:46:27 +0000 |
commit | 764a9f495bcb0af41dee054361ad20e7fdd26fde (patch) | |
tree | 0cab4ff3cce12dc732ebb1c739aa20c04981bf1f /libstdc++-v3 | |
parent | c7b3f7cbc9559c183abea5feab67ea81fb9b9940 (diff) | |
download | gcc-764a9f495bcb0af41dee054361ad20e7fdd26fde.tar.gz |
2005-11-10 Paolo Carlini <pcarlini@suse.de>
Peter Dimov <pdimov@mmltd.net>
* include/tr1/boost_shared_ptr.h (_Sp_counted_base::release):
Optimize by manually inlining weak_release.
* include/tr1/boost_shared_ptr.h (_Sp_counted_base::release,
weak_release): Use explicit memory barriers.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106729 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/boost_shared_ptr.h | 19 |
2 files changed, 20 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index da33a22e5f1..19d2d49b041 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2005-11-10 Paolo Carlini <pcarlini@suse.de> + Peter Dimov <pdimov@mmltd.net> + + * include/tr1/boost_shared_ptr.h (_Sp_counted_base::release): + Optimize by manually inlining weak_release. + + * include/tr1/boost_shared_ptr.h (_Sp_counted_base::release, + weak_release): Use explicit memory barriers. + 2005-11-09 Benjamin Kosnik <bkoz@redhat.com> Paolo Carlini <pcarlini@suse.de> Gabriel Dos Reis <gdr@integrable-solutions.net> diff --git a/libstdc++-v3/include/tr1/boost_shared_ptr.h b/libstdc++-v3/include/tr1/boost_shared_ptr.h index 345e17f8785..3eb94fd980b 100644 --- a/libstdc++-v3/include/tr1/boost_shared_ptr.h +++ b/libstdc++-v3/include/tr1/boost_shared_ptr.h @@ -151,9 +151,12 @@ public: if (__gnu_cxx::__exchange_and_add(&_M_use_count, -1) == 1) { dispose(); - __glibcxx_mutex_lock(_M_mutex); - __glibcxx_mutex_unlock(_M_mutex); - weak_release(); + + _GLIBCXX_READ_MEM_BARRIER; + _GLIBCXX_WRITE_MEM_BARRIER; + + if (__gnu_cxx::__exchange_and_add(&_M_weak_count, -1) == 1) + destroy(); } } @@ -168,8 +171,8 @@ public: { if (__gnu_cxx::__exchange_and_add(&_M_weak_count, -1) == 1) { - __glibcxx_mutex_lock(_M_mutex); - __glibcxx_mutex_unlock(_M_mutex); + _GLIBCXX_READ_MEM_BARRIER; + _GLIBCXX_WRITE_MEM_BARRIER; destroy(); } } @@ -328,7 +331,7 @@ class weak_count { private: - _Sp_counted_base * _M_pi; + _Sp_counted_base* _M_pi; friend class shared_count; @@ -677,8 +680,8 @@ template<typename _Tp> _M_less(const shared_ptr<_Tp1>& __rhs) const { return _M_refcount < __rhs._M_refcount; } - template <typename _Tp1> friend class shared_ptr; - template <typename _Tp1> friend class weak_ptr; + template<typename _Tp1> friend class shared_ptr; + template<typename _Tp1> friend class weak_ptr; // friends injected into enclosing namespace and found by ADL: template<typename _Tp1> |