Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / tools / multiplex / tests / ompt-signal.h
blob9933dbfc39b1027a2580f8540e828280c567699c
1 // These functions are used to provide a signal-wait mechanism to enforce
2 // expected scheduling for the test cases. Conditional variable (s) needs to be
3 // shared! Initialize to 0
4 #include <unistd.h>
6 #define OMPT_SIGNAL(s) ompt_signal(&s)
7 // inline
8 void ompt_signal(int *s) {
9 #pragma omp atomic
10 (*s)++;
13 #define OMPT_WAIT(s, v) ompt_wait(&s, v)
14 // wait for s >= v
15 // inline
16 void ompt_wait(int *s, int v) {
17 int wait = 0;
18 do {
19 usleep(10);
20 #pragma omp atomic read
21 wait = (*s);
22 } while (wait < v);