brintos

brintos / llvm-project-archived public Read only

0
0
Text · 516 B · 9933dbf Raw
24 lines · c
1// These functions are used to provide a signal-wait mechanism to enforce2// expected scheduling for the test cases. Conditional variable (s) needs to be3// shared! Initialize to 04#include <unistd.h>5 6#define OMPT_SIGNAL(s) ompt_signal(&s)7// inline8void ompt_signal(int *s) {9#pragma omp atomic10  (*s)++;11}12 13#define OMPT_WAIT(s, v) ompt_wait(&s, v)14// wait for s >= v15// inline16void ompt_wait(int *s, int v) {17  int wait = 0;18  do {19    usleep(10);20#pragma omp atomic read21    wait = (*s);22  } while (wait < v);23}24