diff --git a/thread-utils.c b/thread-utils.c
index 4f9c829c2df319e386b6b5d4f5c23818cc21c979..7f4b76a95899cc28aa1d42598d1649f126980ed9 100644 (file)
--- a/thread-utils.c
+++ b/thread-utils.c
#include "cache.h"
#include "cache.h"
+#include "thread-utils.h"
#if defined(hpux) || defined(__hpux) || defined(_hpux)
# include <sys/pstat.h>
#if defined(hpux) || defined(__hpux) || defined(_hpux)
# include <sys/pstat.h>
return 1;
}
return 1;
}
+
+int init_recursive_mutex(pthread_mutex_t *m)
+{
+ pthread_mutexattr_t a;
+ int ret;
+
+ ret = pthread_mutexattr_init(&a);
+ if (!ret) {
+ ret = pthread_mutexattr_settype(&a, PTHREAD_MUTEX_RECURSIVE);
+ if (!ret)
+ ret = pthread_mutex_init(m, &a);
+ pthread_mutexattr_destroy(&a);
+ }
+ return ret;
+}