Retro68/gcc/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-2.c

38 lines
623 B
C
Raw Normal View History

2014-09-21 17:33:12 +00:00
/* { 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;
}