diff options
Diffstat (limited to 'libgomp/testsuite/libgomp.c++/cancel-taskgroup-3.C')
-rw-r--r-- | libgomp/testsuite/libgomp.c++/cancel-taskgroup-3.C | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c++/cancel-taskgroup-3.C b/libgomp/testsuite/libgomp.c++/cancel-taskgroup-3.C new file mode 100644 index 00000000000..c897265ef8b --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/cancel-taskgroup-3.C @@ -0,0 +1,58 @@ +// { dg-do run } +// { dg-set-target-env-var OMP_CANCELLATION "true" } + +#include <unistd.h> +#include <omp.h> +#include "cancel-test.h" + +void +foo () +{ + S a, b, c, d, e, f; + #pragma omp parallel private (c, d) firstprivate (e, f) + #pragma omp taskgroup + { + c.bump (); + e.bump (); + #pragma omp task firstprivate (b, f) private (d) + { + S h; + b.bump (); + d.bump (); + f.bump (); + #pragma omp cancel taskgroup + if (omp_get_cancellation ()) + abort (); + } + } + #pragma omp parallel private (c, d) firstprivate (e, f) + { + #pragma omp barrier + #pragma omp single + #pragma omp taskgroup + { + int i; + c.bump (); + e.bump (); + for (i = 0; i < 50; i++) + #pragma omp task firstprivate (b, f) private (d) + { + S h; + b.bump (); + d.bump (); + f.bump (); + #pragma omp cancellation point taskgroup + usleep (30); + #pragma omp cancel taskgroup if (i > 5) + } + } + usleep (10); + } +} + +int +main () +{ + foo (); + S::verify (); +} |