| #include "thread-utils.h" |
| #if defined(hpux) || defined(__hpux) || defined(_hpux) |
| * By doing this in two steps we can at least get |
| * the function to be somewhat coherent, even |
| * with this disgusting nest of #ifdefs. |
| #ifndef _SC_NPROCESSORS_ONLN |
| # define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN |
| # elif defined _SC_CRAY_NCPU |
| # define _SC_NPROCESSORS_ONLN _SC_CRAY_NCPU |
| #ifdef _SC_NPROCESSORS_ONLN |
| #ifdef GIT_WINDOWS_NATIVE |
| if ((int)info.dwNumberOfProcessors > 0) |
| return (int)info.dwNumberOfProcessors; |
| #elif defined(hpux) || defined(__hpux) || defined(_hpux) |
| if (!pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0)) |
| return (int)psd.psd_proc_cnt; |
| #ifdef _SC_NPROCESSORS_ONLN |
| if ((ncpus = (long)sysconf(_SC_NPROCESSORS_ONLN)) > 0) |
| int init_recursive_mutex(pthread_mutex_t *m) |
| ret = pthread_mutexattr_init(&a); |
| ret = pthread_mutexattr_settype(&a, PTHREAD_MUTEX_RECURSIVE); |
| ret = pthread_mutex_init(m, &a); |
| pthread_mutexattr_destroy(&a); |