diff options
author | Kostya Serebryany <kcc@google.com> | 2010-08-12 22:56:59 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2010-08-12 22:56:59 +0000 |
commit | be335b18a9133f849e2d927abdd945c68fc3c716 (patch) | |
tree | 0e6c156d49fe7f64d815154ccc4cbd3c33f02455 /libstdc++-v3/include/ext/rc_string_base.h | |
parent | 644fa7acbdafe5d5c5ddea0e0dd0ca73781500ca (diff) | |
download | gcc-be335b18a9133f849e2d927abdd945c68fc3c716.zip gcc-be335b18a9133f849e2d927abdd945c68fc3c716.tar.gz gcc-be335b18a9133f849e2d927abdd945c68fc3c716.tar.bz2 |
c++config (_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE, [...]): Add.
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.
Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com>
From-SVN: r163210
Diffstat (limited to 'libstdc++-v3/include/ext/rc_string_base.h')
-rw-r--r-- | libstdc++-v3/include/ext/rc_string_base.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h index dd18738..32c9d38 100644 --- a/libstdc++-v3/include/ext/rc_string_base.h +++ b/libstdc++-v3/include/ext/rc_string_base.h @@ -199,9 +199,16 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) void _M_dispose() { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_rep()->_M_info. + _M_refcount) if (__exchange_and_add_dispatch(&_M_rep()->_M_info._M_refcount, -1) <= 0) - _M_rep()->_M_destroy(_M_get_allocator()); + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_rep()->_M_info. + _M_refcount) + _M_rep()->_M_destroy(_M_get_allocator()); + } } // XXX MT bool |