aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/rc_string_base.h
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2006-05-24 16:37:42 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2006-05-24 16:37:42 +0000
commitb7ee72de2db0a89db568b94650e06ead6ed1feaf (patch)
treeb8b2c3c4ae586040aae8bf0603bd2720d6524ce1 /libstdc++-v3/include/ext/rc_string_base.h
parentcc07b2dbebe3a752b1d01e6f62d8a2e71abb5c4e (diff)
downloadgcc-b7ee72de2db0a89db568b94650e06ead6ed1feaf.zip
gcc-b7ee72de2db0a89db568b94650e06ead6ed1feaf.tar.gz
gcc-b7ee72de2db0a89db568b94650e06ead6ed1feaf.tar.bz2
re PR libstdc++/24704 (__gnu_cxx::__exchange_and_add is called even for single threaded applications)
2006-05-24 Paolo Carlini <pcarlini@suse.de> PR libstdc++/24704 * include/bits/atomicity.h (__exchange_and_add_single, __atomic_add_single): New, single thread versions of the atomic functions. (__exchange_and_add_dispatch, __atomic_add_dispatch): New, depending on __GTHREADS and __gthread_active_p() dispatch either to the above or to the existing atomic functions. * include/ext/pool_allocator.h: Update callers. * 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. * include/tr1/boost_shared_ptr.h: Likewise. * src/ios.cc: Likewise. * src/locale.cc: Likewise. * src/ios_init.cc: Likewise. From-SVN: r114044
Diffstat (limited to 'libstdc++-v3/include/ext/rc_string_base.h')
-rw-r--r--libstdc++-v3/include/ext/rc_string_base.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h
index dece887d..c8bb9f3 100644
--- a/libstdc++-v3/include/ext/rc_string_base.h
+++ b/libstdc++-v3/include/ext/rc_string_base.h
@@ -1,6 +1,6 @@
// Reference-counted versatile string base -*- C++ -*-
-// Copyright (C) 2005 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -134,7 +134,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_CharT*
_M_refcopy() throw()
{
- __atomic_add(&_M_info._M_refcount, 1);
+ __atomic_add_dispatch(&_M_info._M_refcount, 1);
return _M_refdata();
} // XXX MT
@@ -202,7 +202,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
void
_M_dispose()
{
- if (__exchange_and_add(&_M_rep()->_M_info._M_refcount, -1) <= 0)
+ if (__exchange_and_add_dispatch(&_M_rep()->_M_info._M_refcount,
+ -1) <= 0)
_M_rep()->_M_destroy(_M_get_allocator());
} // XXX MT