X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=thread-utils.c;h=589f838f82b568195232ea81346d0049261b86b1;hb=937491944292fa3303b565b9bd8914c6b644ab13;hp=55e7e2904eb5f95cedaec2520ddd1d158ee93c7a;hpb=d96ca27e1089a190139591ac365873f26bffcf5c;p=thirdparty%2Fgit.git diff --git a/thread-utils.c b/thread-utils.c index 55e7e2904e..589f838f82 100644 --- a/thread-utils.c +++ b/thread-utils.c @@ -1,9 +1,7 @@ #include "cache.h" +#include -#ifdef _WIN32 -# define WIN32_LEAN_AND_MEAN -# include -#elif defined(hpux) || defined(__hpux) || defined(_hpux) +#if defined(hpux) || defined(__hpux) || defined(_hpux) # include #endif @@ -46,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; +}