summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/bits/basic_string.h
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-12 22:56:59 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-12 22:56:59 +0000
commitd8155f717c2ac0ba8a6251bdfa0e50fc90c9a181 (patch)
tree0e6c156d49fe7f64d815154ccc4cbd3c33f02455 /libstdc++-v3/include/bits/basic_string.h
parent99b66d21e0d1073bc594d7bfaa0422c77db449cc (diff)
downloadppe42-gcc-d8155f717c2ac0ba8a6251bdfa0e50fc90c9a181.tar.gz
ppe42-gcc-d8155f717c2ac0ba8a6251bdfa0e50fc90c9a181.zip
2010-08-12 Kostya Serebryany <kcc@google.com>
Paolo Carlini <paolo.carlini@oracle.com> * include/bits/c++config (_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE, _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER): Add. * src/ios_init.cc (ios_base::Init::~Init): Decorate with the latter. * include/tr1_impl/boost_sp_counted_base.h: Likewise. * include/ext/rc_string_base.h: Likewise. * include/bits/locale_classes.h: Likewise. * include/bits/basic_string.h: Likewise. * include/bits/ios_base.h: Likewise. * testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust dg-error line number. * testsuite/27_io/ios_base/cons/copy_neg.cc: Likewise. * testsuite/ext/profile/mutex_extensions.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163210 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/basic_string.h')
-rw-r--r--libstdc++-v3/include/bits/basic_string.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index fe9e1a3519c..74820eb348e 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -232,9 +232,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
if (__builtin_expect(this != &_S_empty_rep(), false))
#endif
- if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
- -1) <= 0)
- _M_destroy(__a);
+ {
+ // Be race-detector-friendly. For more info see bits/c++config.
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount)
+ if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
+ -1) <= 0)
+ {
+ _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount)
+ _M_destroy(__a);
+ }
+ }
} // XXX MT
void
OpenPOWER on IntegriCloud