aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/config/cpu
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2004-03-07 01:32:43 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2004-03-07 01:32:43 +0000
commitf83295bafc73a70666d5d67e05918b0e6882402c (patch)
treef71f116f1f9678557e7764415bf032ec269eadcf /libstdc++-v3/config/cpu
parent018e1b3b0b15655000518abaeca2c86c8fadf8a6 (diff)
downloadgcc-f83295bafc73a70666d5d67e05918b0e6882402c.zip
gcc-f83295bafc73a70666d5d67e05918b0e6882402c.tar.gz
gcc-f83295bafc73a70666d5d67e05918b0e6882402c.tar.bz2
re PR libstdc++/12658 (Thread safety problems in locale::global() and locale::locale())
2004-03-06 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/12658 * src/locale_init.cc (locale::locale): Lock critical regions with external mutexes. (locale::global): Same. * include/bits/concurrence.h (__glibcxx_mutex_define_initialized): Add in once bits for cases without __GTHREAD_MUTEX_INIT. (__glibcxx_mutex_lock): Same. * config/cpu/generic/atomicity.h: Remove _GLIBCXX_NEED_GENERIC_MUTEX, use concurrence.h. * src/misc-inst.cc: Move all locking bits out of this file. * config/os/hpux/os_defines.h: Remove _GLIBCXX_INST_ATOMICITY_LOCK. * src/misc-inst.cc: Same. * config/cpu/hppa/atomicity.h: Same. * config/linker-map.gnu: Remove types in the signature of atomic exports, as they may vary. From-SVN: r79043
Diffstat (limited to 'libstdc++-v3/config/cpu')
-rw-r--r--libstdc++-v3/config/cpu/generic/atomicity.h24
-rw-r--r--libstdc++-v3/config/cpu/hppa/atomicity.h5
2 files changed, 8 insertions, 21 deletions
diff --git a/libstdc++-v3/config/cpu/generic/atomicity.h b/libstdc++-v3/config/cpu/generic/atomicity.h
index 8481790..f30005a 100644
--- a/libstdc++-v3/config/cpu/generic/atomicity.h
+++ b/libstdc++-v3/config/cpu/generic/atomicity.h
@@ -28,34 +28,24 @@
// the GNU General Public License.
#include <bits/atomicity.h>
-#include <bits/gthr.h>
+#include <bits/concurrence.h>
-#define _GLIBCXX_NEED_GENERIC_MUTEX
+namespace __gnu_internal
+{
+ __glibcxx_mutex_define_initialized(atomic_mutex);
+} // namespace __gnu_internal
namespace __gnu_cxx
{
- extern __gthread_mutex_t _Atomic_add_mutex;
-
-#ifndef __GTHREAD_MUTEX_INIT
- extern __gthread_once_t _Atomic_add_mutex_once;
- extern void __gthread_atomic_add_mutex_once();
-#endif
-
_Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{
-#ifndef __GTHREAD_MUTEX_INIT
- __gthread_once(&__gnu_cxx::_Atomic_add_mutex_once,
- __gnu_cxx::__gthread_atomic_add_mutex_once);
-#endif
-
+ __glibcxx_mutex_lock(__gnu_internal::atomic_mutex);
_Atomic_word __result;
- __gthread_mutex_lock(&__gnu_cxx::_Atomic_add_mutex);
__result = *__mem;
*__mem += __val;
-
- __gthread_mutex_unlock(&__gnu_cxx::_Atomic_add_mutex);
+ __glibcxx_mutex_unlock(__gnu_internal::atomic_mutex);
return __result;
}
diff --git a/libstdc++-v3/config/cpu/hppa/atomicity.h b/libstdc++-v3/config/cpu/hppa/atomicity.h
index d173976..48c8283 100644
--- a/libstdc++-v3/config/cpu/hppa/atomicity.h
+++ b/libstdc++-v3/config/cpu/hppa/atomicity.h
@@ -43,11 +43,8 @@ namespace __gnu_cxx
_Atomicity_lock<_Inst>::_S_atomicity_lock __attribute__ ((aligned (16))) = 1;
// Because of the lack of weak support when using the hpux som
- // linker, we explicitly instantiate the atomicity lock in
- // src/misc-inst.cc when _GLIBCXX_INST_ATOMICITY_LOCK is defined.
-#ifndef _GLIBCXX_INST_ATOMICITY_LOCK
+ // linker, we explicitly instantiate the atomicity lock.
template volatile int _Atomicity_lock<0>::_S_atomicity_lock;
-#endif
int
__attribute__ ((__unused__))