aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/config/cpu
diff options
context:
space:
mode:
authorJ"orn Rennecke <joern.rennecke@st.com>2005-08-19 11:50:21 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2005-08-19 12:50:21 +0100
commite27ce37987e028aeba1c9c58d8a93f5e8dbf5da0 (patch)
treecd131fa070364c965ab39ae64263636bd9ea684c /libstdc++-v3/config/cpu
parenta132dad65cb865aba22f2fae83a357977a19452f (diff)
downloadgcc-e27ce37987e028aeba1c9c58d8a93f5e8dbf5da0.zip
gcc-e27ce37987e028aeba1c9c58d8a93f5e8dbf5da0.tar.gz
gcc-e27ce37987e028aeba1c9c58d8a93f5e8dbf5da0.tar.bz2
atomicity.h: Replace broken generic code with current copy of generic/atomicity.h .
* config/cpu/sh/atomicity.h: Replace broken generic code with current copy of generic/atomicity.h . From-SVN: r103274
Diffstat (limited to 'libstdc++-v3/config/cpu')
-rw-r--r--libstdc++-v3/config/cpu/sh/atomicity.h72
1 files changed, 28 insertions, 44 deletions
diff --git a/libstdc++-v3/config/cpu/sh/atomicity.h b/libstdc++-v3/config/cpu/sh/atomicity.h
index cba2404..8760c8b 100644
--- a/libstdc++-v3/config/cpu/sh/atomicity.h
+++ b/libstdc++-v3/config/cpu/sh/atomicity.h
@@ -1,6 +1,7 @@
// Low-level functions for atomic operations: Generic version -*- C++ -*-
-// Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005
+// 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
@@ -69,55 +70,38 @@ __atomic_add (volatile _Atomic_word* __mem, int __val)
: "r0");
}
-#else
+#else /* !__SH4A__ */
/* This is generic/atomicity.h */
-#include <bits/gthr.h>
+#include <bits/atomicity.h>
+#include <bits/concurrence.h>
-#define _GLIBCPP_NEED_GENERIC_MUTEX
-
-typedef int _Atomic_word;
-
-namespace __gnu_cxx
+namespace __gnu_internal
{
- 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
-}
-
-static inline _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
-
- _Atomic_word __result;
+ __glibcxx_mutex_define_initialized(atomic_mutex);
+} // namespace __gnu_internal
- __gthread_mutex_lock (&__gnu_cxx::_Atomic_add_mutex);
-
- __result = *__mem;
- *__mem += __val;
-
- __gthread_mutex_unlock (&__gnu_cxx::_Atomic_add_mutex);
- return __result;
-}
-
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add (volatile _Atomic_word* __mem, int __val)
+namespace __gnu_cxx
{
- (void) __exchange_and_add (__mem, __val);
-}
-
-
-#endif
+ _Atomic_word
+ __attribute__ ((__unused__))
+ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
+ {
+ __glibcxx_mutex_lock(__gnu_internal::atomic_mutex);
+ _Atomic_word __result;
+ __result = *__mem;
+ *__mem += __val;
+ __glibcxx_mutex_unlock(__gnu_internal::atomic_mutex);
+ return __result;
+ }
+
+ void
+ __attribute__ ((__unused__))
+ __atomic_add(volatile _Atomic_word* __mem, int __val)
+ { __exchange_and_add(__mem, __val); }
+} // namespace __gnu_cxx
+
+#endif /* !__SH4A__ */
#endif /* atomicity.h */