aboutsummaryrefslogtreecommitdiff
path: root/gcc/gthr-tpf.h
diff options
context:
space:
mode:
authorJim Tison <jtison@us.ibm.com>2006-11-29 13:00:12 +0000
committerUlrich Weigand <uweigand@gcc.gnu.org>2006-11-29 13:00:12 +0000
commit6db288928624b2fb7bf0a4bfd9f6222dc42ba2b7 (patch)
tree9d47132b94b46590bbe574988db922dfbe4933f2 /gcc/gthr-tpf.h
parent0cfbc62b0b8697c3e248295cd076e91cd890926c (diff)
downloadgcc-6db288928624b2fb7bf0a4bfd9f6222dc42ba2b7.zip
gcc-6db288928624b2fb7bf0a4bfd9f6222dc42ba2b7.tar.gz
gcc-6db288928624b2fb7bf0a4bfd9f6222dc42ba2b7.tar.bz2
gthr-tpf.h (__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION, [...]): Define.
2006-11-29 Jim Tison <jtison@us.ibm.com> * gthr-tpf.h (__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION, __gthread_recursive_mutex_init): Define. From-SVN: r119311
Diffstat (limited to 'gcc/gthr-tpf.h')
-rw-r--r--gcc/gthr-tpf.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/gthr-tpf.h b/gcc/gthr-tpf.h
index e6951e1..b63d527 100644
--- a/gcc/gthr-tpf.h
+++ b/gcc/gthr-tpf.h
@@ -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 */