aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/src
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/src
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/src')
-rw-r--r--libstdc++-v3/src/ios.cc2
-rw-r--r--libstdc++-v3/src/ios_init.cc6
-rw-r--r--libstdc++-v3/src/locale.cc3
3 files changed, 6 insertions, 5 deletions
diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc
index 5b05f28..e22c681 100644
--- a/libstdc++-v3/src/ios.cc
+++ b/libstdc++-v3/src/ios.cc
@@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Implementation note: Initialize top to zero to ensure that
// initialization occurs before main() is started.
static _Atomic_word _S_top = 0;
- return __gnu_cxx::__exchange_and_add(&_S_top, 1) + 4;
+ return __gnu_cxx::__exchange_and_add_dispatch(&_S_top, 1) + 4;
}
void
diff --git a/libstdc++-v3/src/ios_init.cc b/libstdc++-v3/src/ios_init.cc
index 93a3985..680efdd 100644
--- a/libstdc++-v3/src/ios_init.cc
+++ b/libstdc++-v3/src/ios_init.cc
@@ -82,7 +82,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
ios_base::Init::Init()
{
- if (__gnu_cxx::__exchange_and_add(&_S_refcount, 1) == 0)
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, 1) == 0)
{
// Standard streams default to synced with "C" operations.
_S_synced_with_stdio = true;
@@ -121,13 +121,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// streams are not re-initialized with uses of ios_base::Init
// besides <iostream> static object, ie just using <ios> with
// ios_base::Init objects.
- __gnu_cxx::__atomic_add(&_S_refcount, 1);
+ __gnu_cxx::__atomic_add_dispatch(&_S_refcount, 1);
}
}
ios_base::Init::~Init()
{
- if (__gnu_cxx::__exchange_and_add(&_S_refcount, -1) == 2)
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, -1) == 2)
{
// Catch any exceptions thrown by basic_ostream::flush()
try
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc
index c56ec51..22d8ab0 100644
--- a/libstdc++-v3/src/locale.cc
+++ b/libstdc++-v3/src/locale.cc
@@ -433,7 +433,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_index = 1 + f->_M_id();
else
#endif
- _M_index = 1 + __gnu_cxx::__exchange_and_add(&_S_refcount, 1);
+ _M_index = 1 + __gnu_cxx::__exchange_and_add_dispatch(&_S_refcount,
+ 1);
}
return _M_index - 1;
}