2004-10-02 P.J. Darcy <darcypj@us.ibm.com>
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 2 Oct 2004 00:48:44 +0000 (00:48 +0000)
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 2 Oct 2004 00:48:44 +0000 (00:48 +0000)
* gthr-tpf.h (__gthread_recursive_mutex_t): New type.
(__GTHREAD_RECURSIVE_MUTEX_INIT): Define.
(__gthread_recursive_mutex_lock, __gthread_recursive_mutex_trylock,
__gthread_recursive_mutex_unlock): New functions.

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

gcc/ChangeLog
gcc/gthr-tpf.h

index 8e4f0fc..24a1034 100644 (file)
@@ -1,5 +1,12 @@
 2004-10-02  P.J. Darcy  <darcypj@us.ibm.com>
 
+       * gthr-tpf.h (__gthread_recursive_mutex_t): New type.
+       (__GTHREAD_RECURSIVE_MUTEX_INIT): Define.
+       (__gthread_recursive_mutex_lock, __gthread_recursive_mutex_trylock,
+       __gthread_recursive_mutex_unlock): New functions.
+
+2004-10-02  P.J. Darcy  <darcypj@us.ibm.com>
+
        * config/s390/t-tpf (LIB2ADDEH): Remove tpf-eh.c.
        * config/s390/tpf-eh.c: Remove file.
        * config/s390/tpf-unwind.h: New file.
index 9831c66..6eac833 100644 (file)
@@ -51,6 +51,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 typedef pthread_key_t __gthread_key_t;
 typedef pthread_once_t __gthread_once_t;
 typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#endif
 
 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
 #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
@@ -154,4 +161,31 @@ __gthread_mutex_unlock (__gthread_mutex_t *mutex)
     return 0;
 }
 
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_lock (mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_trylock (mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_unlock (mutex);
+  else
+    return 0;
+}
+
 #endif /* ! GCC_GTHR_TPF_H */