Skip to content

Instantly share code, notes, and snippets.

@khenriks
Created May 30, 2014 01:18
Show Gist options
  • Save khenriks/82b3e5f788d61ce66fe0 to your computer and use it in GitHub Desktop.
Save khenriks/82b3e5f788d61ce66fe0 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <omp.h>
#include <pthread.h>
int main() {
omp_lock_t lock;
long x = 0;
omp_init_lock(&lock);
for (int i=0; i<1; ++i) {
omp_set_lock(&lock);
omp_unset_lock(&lock);
}
omp_destroy_lock(&lock);
printf("sizeof(omp_lock_t): %zu\n", sizeof(omp_lock_t));
printf("sizeof(pthread_mutex_t): %zu\n", sizeof(pthread_mutex_t));
printf("Value of x (should be 0): %ld\n", x);
return x != 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment