summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c')
-rw-r--r--libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c b/libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c
new file mode 100644
index 00000000000..c7b8bf75623
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+/* { dg-set-target-env-var OMP_CANCELLATION "true" } */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <omp.h>
+
+int
+main ()
+{
+ #pragma omp parallel
+ #pragma omp taskgroup
+ #pragma omp task
+ {
+ #pragma omp cancel taskgroup
+ if (omp_get_cancellation ())
+ abort ();
+ }
+ #pragma omp parallel
+ {
+ #pragma omp barrier
+ #pragma omp single
+ #pragma omp taskgroup
+ {
+ int i;
+ for (i = 0; i < 50; i++)
+ #pragma omp task
+ {
+ #pragma omp cancellation point taskgroup
+ usleep (30);
+ #pragma omp cancel taskgroup if (i > 5)
+ }
+ }
+ usleep (10);
+ }
+ return 0;
+}