1 // RUN: %compile-run-and-check
6 int main(int argc
, char *argv
[]) {
7 int data
, out
, flag
= 0;
8 #pragma omp target parallel num_threads(64) map(tofrom \
12 if (omp_get_thread_num() == 0) {
13 /* Write to the data buffer that will be read by thread */
15 /* Flush data to thread 32 */
16 #pragma omp flush(data)
17 /* Set flag to release thread 32 */
18 #pragma omp atomic write
20 } else if (omp_get_thread_num() == 32) {
21 /* Loop until we see the update to the flag */
24 #pragma omp atomic read
28 #pragma omp flush(out)
32 /* Value of out will be 42 */
33 printf("out=%d.\n", out
);