@@ -1,8 +1,7 @@
/* RTEMS threads compatibility routines for libgcc2 and libobjc.
by: Rosimildo da Silva( rdasilva@connecttel.com ) */
/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2002, 2003, 2005, 2008, 2009
- Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of GCC.
@@ -150,6 +149,12 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
return rtems_gxx_recursive_mutex_unlock( __mutex );
}
+static inline int
+__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
+{
+ return rtems_gxx_mutex_destroy( __mutex );
+}
+
#ifdef __cplusplus
}
#endif
@@ -1,7 +1,6 @@
/* Threads compatibility routines for libgcc2 and libobjc for VxWorks. */
/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2008, 2009, 2011
- Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
Contributed by Mike Stump <mrs@wrs.com>.
This file is part of GCC.
@@ -111,6 +110,12 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
return __gthread_mutex_unlock (mutex);
}
+static inline int
+__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
+{
+ return __gthread_mutex_destroy (__mutex);
+}
+
/* pthread_once is complicated enough that it's implemented
out-of-line. See config/vxlib.c. */
@@ -1,8 +1,7 @@
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
-/* Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2008, 2009
- Free Software Foundation, Inc.
+/* Copyright (C) 1999-2012 Free Software Foundation, Inc.
Contributed by Mumit Khan <khan@xraylith.wisc.edu>.
This file is part of GCC.
@@ -536,6 +535,14 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
return 0;
}
+static inline void
+__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex)
+{
+ __gthread_mutex_t __mutex2;
+ __mutex2.sema = mutex->sema;
+ __gthr_win32_mutex_destroy (&__mutex2);
+}
+
#else /* ! __GTHREAD_HIDE_WIN32API */
#include <windows.h>
@@ -761,6 +768,12 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
return 0;
}
+static inline void
+__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex)
+{
+ CloseHandle ((HANDLE) mutex->sema);
+}
+
#endif /* __GTHREAD_HIDE_WIN32API */
#ifdef __cplusplus
@@ -1,6 +1,6 @@
/* MIPS SDE threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
-/* Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2012 Free Software Foundation, Inc.
Contributed by Nigel Stephens <nigel@mips.com>
This file is part of GCC.
@@ -223,6 +223,12 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
return 0;
}
+static inline int
+__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
+{
+ return __gthread_mutex_destroy(__mutex);
+}
+
#ifdef __cplusplus
}
#endif
@@ -1,7 +1,6 @@
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2001, 2004, 2005, 2008, 2009
- Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of GCC.
@@ -557,6 +556,12 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
return __gthread_mutex_unlock (__mutex);
}
+static inline int
+__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
+{
+ return __gthread_mutex_destroy (__mutex);
+}
+
#endif /* _LIBOBJC */
#endif
@@ -1,6 +1,6 @@
/* Threads compatibility routines for libgcc2 and libobjc.
Compile this one with gcc.
- Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2004-2012 Free Software Foundation, Inc.
This file is part of GCC.
@@ -225,5 +225,10 @@ __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
return 0;
}
+static inline int
+__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
+{
+ return __gthread_mutex_destroy (__mutex);
+}
#endif /* ! GCC_GTHR_TPF_H */
@@ -832,6 +832,12 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
return __gthread_mutex_unlock (__mutex);
}
+static inline int
+__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
+{
+ return __gthread_mutex_destroy (__mutex);
+}
+
#ifdef _GTHREAD_USE_COND_INIT_FUNC
static inline void
__gthread_cond_init_function (__gthread_cond_t *__cond)
@@ -1,7 +1,6 @@
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
- Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of GCC.
@@ -286,6 +285,12 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
return __gthread_mutex_unlock (__mutex);
}
+static inline int
+__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
+{
+ return __gthread_mutex_destroy (__mutex);
+}
+
#endif /* _LIBOBJC */
#undef UNUSED
@@ -1,7 +1,6 @@
/* Threads compatibility routines for libgcc2. */
/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1998, 2004, 2008, 2009, 2011
- Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of GCC.
@@ -73,6 +72,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
int __gthread_setspecific (__gthread_key_t key, const void *ptr)
int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
+ int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex);
int __gthread_mutex_lock (__gthread_mutex_t *mutex);
int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
@@ -219,7 +219,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~__recursive_mutex()
{
if (__gthread_active_p())
- _S_destroy(&_M_mutex);
+ __gthread_recursive_mutex_destroy(&_M_mutex);
}
#endif
@@ -247,43 +247,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__gthread_recursive_mutex_t* gthread_recursive_mutex(void)
{ return &_M_mutex; }
-
-#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT
- // FIXME: gthreads doesn't define __gthread_recursive_mutex_destroy
- // so we need to obtain a __gthread_mutex_t to destroy
- private:
- template<typename _Mx, typename _Rm>
- static void
- _S_destroy_win32(_Mx* __mx, _Rm const* __rmx)
- {
- __mx->counter = __rmx->counter;
- __mx->sema = __rmx->sema;
- __gthread_mutex_destroy(__mx);
- }
-
- // matches a gthr-win32.h recursive mutex
- template<typename _Rm>
- static typename __enable_if<(bool)sizeof(&_Rm::sema), void>::__type
- _S_destroy(_Rm* __mx)
- {
- __gthread_mutex_t __tmp;
- _S_destroy_win32(&__tmp, __mx);
- }
-
- // matches a recursive mutex with a member 'actual'
- template<typename _Rm>
- static typename __enable_if<(bool)sizeof(&_Rm::actual), void>::__type
- _S_destroy(_Rm* __mx)
- { __gthread_mutex_destroy(&__mx->actual); }
-
- // matches when there's only one mutex type
- template<typename _Rm>
- static typename
- __enable_if<std::__are_same<_Rm, __gthread_mutex_t>::__value,
- void>::__type
- _S_destroy(_Rm* __mx)
- { __gthread_mutex_destroy(__mx); }
-#endif
};
/// Scoped lock idiom.
@@ -101,42 +101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
~__recursive_mutex_base()
- { _S_destroy(&_M_mutex); }
-
- private:
- // FIXME: gthreads doesn't define __gthread_recursive_mutex_destroy
- // so we need to obtain a __gthread_mutex_t to destroy
-
- // matches when there's only one mutex type
- template<typename _Rm>
- static
- typename enable_if<is_same<_Rm, __gthread_mutex_t>::value, void>::type
- _S_destroy(_Rm* __mx)
- { __gthread_mutex_destroy(__mx); }
-
- // matches a recursive mutex with a member 'actual'
- template<typename _Rm>
- static typename enable_if<(bool)sizeof(&_Rm::actual), void>::type
- _S_destroy(_Rm* __mx)
- { __gthread_mutex_destroy(&__mx->actual); }
-
- // matches a gthr-win32.h recursive mutex
- template<typename _Rm>
- static typename enable_if<(bool)sizeof(&_Rm::sema), void>::type
- _S_destroy(_Rm* __mx)
- {
- __gthread_mutex_t __tmp;
- _S_destroy_win32(&__tmp, __mx);
- }
-
- template<typename _Mx, typename _Rm>
- static void
- _S_destroy_win32(_Mx* __mx, _Rm const* __rmx)
- {
- __mx->counter = __rmx->counter;
- __mx->sema = __rmx->sema;
- __gthread_mutex_destroy(__mx);
- }
+ { __gthread_recursive_mutex_destroy(&_M_mutex); }
#endif
};