25 #pragma omp atomic read
29 if (secs == timelimit) {
30 fprintf(stderr,
"error: timeout in wait_on_flag()\n");
33 }
while (flag_value == 0);
41int main(
int argc,
char** argv) {
48 #pragma omp parallel shared(a)
53 #pragma omp single nowait
66 #pragma omp taskwait depend(inout: a)
72 #pragma omp task depend(inout: b)
83 #pragma omp taskwait depend(inout: a)
88 #pragma omp task shared(a) depend(inout: a)
94 #pragma omp taskwait depend(inout: a)
96 #pragma omp atomic read
100 fprintf(stderr,
"error: dependent task was not executed before "
101 "taskwait finished\n");
#define omp_set_num_threads
static void signal_flag(int *flag)
static void wait_on_flag(int *flag)
static void my_sleep(double sleeptime)
Utility function to have a sleep function with better resolution and which only stops one thread.
int omp_get_max_threads()
int omp_get_num_threads()