omp-lock.h 990 B

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