libgomp/testsuite/libgomp.c++/cancel-for-1.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-set-target-env-var OMP_CANCELLATION "true" } |
| 3 | |
| 4 | #include <omp.h> |
| 5 | #include "cancel-test.h" |
| 6 | |
| 7 | int |
| 8 | main () |
| 9 | { |
| 10 | { |
| 11 | S c; |
| 12 | #pragma omp parallel num_threads (32) |
| 13 | { |
| 14 | S a, b; |
| 15 | int i; |
| 16 | #pragma omp for private (b) firstprivate (c) |
| 17 | for (i = 0; i < 1000; ++i) |
| 18 | { |
| 19 | S d; |
| 20 | #pragma omp cancel for |
| 21 | if (omp_get_cancellation ()) |
| 22 | abort (); |
| 23 | b.bump (); |
| 24 | c.bump (); |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | S::verify (); |
| 29 | } |