1*629ff9f7SJohn Marino /* This header is used during the build process to find the size and 2*629ff9f7SJohn Marino alignment of the public OpenMP locks, so that we can export data 3*629ff9f7SJohn Marino structures without polluting the namespace. 4*629ff9f7SJohn Marino 5*629ff9f7SJohn Marino In this default POSIX implementation, we used to map the two locks to the 6*629ff9f7SJohn Marino same PTHREADS primitive, but for OpenMP 3.0 sem_t needs to be used 7*629ff9f7SJohn Marino instead, as pthread_mutex_unlock should not be called by different 8*629ff9f7SJohn Marino thread than the one that called pthread_mutex_lock. */ 9*629ff9f7SJohn Marino 10*629ff9f7SJohn Marino #include <pthread.h> 11*629ff9f7SJohn Marino #include <semaphore.h> 12*629ff9f7SJohn Marino 13*629ff9f7SJohn Marino typedef pthread_mutex_t omp_lock_25_t; 14*629ff9f7SJohn Marino typedef struct { pthread_mutex_t lock; int count; } omp_nest_lock_25_t; 15*629ff9f7SJohn Marino #ifdef HAVE_BROKEN_POSIX_SEMAPHORES 16*629ff9f7SJohn Marino /* If we don't have working semaphores, we'll make all explicit tasks 17*629ff9f7SJohn Marino tied to the creating thread. */ 18*629ff9f7SJohn Marino typedef pthread_mutex_t omp_lock_t; 19*629ff9f7SJohn Marino typedef struct { pthread_mutex_t lock; int count; void *owner; } omp_nest_lock_t; 20*629ff9f7SJohn Marino #else 21*629ff9f7SJohn Marino typedef sem_t omp_lock_t; 22*629ff9f7SJohn Marino typedef struct { sem_t lock; int count; void *owner; } omp_nest_lock_t; 23*629ff9f7SJohn Marino #endif 24