X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=thread-utils.c;h=589f838f82b568195232ea81346d0049261b86b1;hb=7e2bfd3f;hp=4f9c829c2df319e386b6b5d4f5c23818cc21c979;hpb=a19f101e3f31234db23bd1eb24994db6e4caa443;p=git.git diff --git a/thread-utils.c b/thread-utils.c index 4f9c829c2..589f838f8 100644 --- a/thread-utils.c +++ b/thread-utils.c @@ -1,4 +1,5 @@ #include "cache.h" +#include #if defined(hpux) || defined(__hpux) || defined(_hpux) # include @@ -43,3 +44,18 @@ int online_cpus(void) 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; +}