diff options
Diffstat (limited to 'thread-utils.c')
-rw-r--r-- | thread-utils.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/thread-utils.c b/thread-utils.c index 4f9c829c2d..97396a75ae 100644 --- a/thread-utils.c +++ b/thread-utils.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "thread-utils.h" #if defined(hpux) || defined(__hpux) || defined(_hpux) # include <sys/pstat.h> @@ -23,7 +24,7 @@ int online_cpus(void) long ncpus; #endif -#ifdef _WIN32 +#ifdef GIT_WINDOWS_NATIVE SYSTEM_INFO info; GetSystemInfo(&info); @@ -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; +} |