]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2006-11-29 Jim Tison <jtison@us.ibm.com>
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Nov 2006 13:00:12 +0000 (13:00 +0000)
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Nov 2006 13:00:12 +0000 (13:00 +0000)
* gthr-tpf.h (__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION,
__gthread_recursive_mutex_init): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119311 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gthr-tpf.h

index 0c02f8bede58b2b0b3a104c51fb198170db2dd29..728fc0aa4ed0734c87282cd9599dc1c20df5a46c 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-29  Jim Tison  <jtison@us.ibm.com>
+
+       * gthr-tpf.h (__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION,
+       __gthread_recursive_mutex_init): Define.
+
 2006-11-29  Joseph Myers  <joseph@codesourcery.com>
 
        * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): If
index e6951e1a01d82b2abf98b60b319cd60d8346aa91..b63d527e8865e204a5bf633e57ecebe125940f1e 100644 (file)
@@ -61,6 +61,7 @@ typedef pthread_mutex_t __gthread_recursive_mutex_t;
 
 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
 #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
 
 #define NOTATHREAD   00
 #define ECBBASEPTR (unsigned long int) *(unsigned int *)0x00000514u
@@ -87,6 +88,10 @@ __gthrw(pthread_create)
 __gthrw(pthread_mutex_lock)
 __gthrw(pthread_mutex_trylock)
 __gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+__gthrw(pthread_mutex_init)
 
 static inline int
 __gthread_active_p (void)
@@ -193,4 +198,25 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
     return 0;
 }
 
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
+{ 
+  if (__tpf_pthread_active ())
+    {
+      pthread_mutexattr_t attr;
+      int r;
+
+      r = __gthrw_(pthread_mutexattr_init) (&attr);
+      if (!r)
+       r = __gthrw_(pthread_mutexattr_settype) (&attr, PTHREAD_MUTEX_RECURSIVE);
+      if (!r)
+       r = __gthrw_(pthread_mutex_init) (mutex, &attr);
+      if (!r)
+       r = __gthrw_(pthread_mutexattr_destroy) (&attr);
+      return r;
+    }
+  return 0;
+}
+
+
 #endif /* ! GCC_GTHR_TPF_H */