Daily bump.
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / pause-2.c
blobe4781cdc70756e7324c7e01a0aa1ff51d712f541
1 /* { dg-do run } */
2 /* { dg-require-effective-target tls_runtime } */
4 #include <omp.h>
5 #include <stdlib.h>
7 int t = 128;
8 #pragma omp threadprivate (t)
10 int
11 main ()
13 #pragma omp parallel
14 t = omp_get_thread_num () + 256;
15 #pragma omp parallel
16 if (t != omp_get_thread_num () + 256)
17 abort ();
18 omp_pause_resource (omp_pause_soft, omp_get_initial_device ());
19 /* This goes beyond what is required by the standard, we actually
20 check if the threads other than the initial one have been destroyed. */
21 #pragma omp parallel
23 if (omp_get_thread_num () != 0 && t != 128)
24 abort ();
25 t = omp_get_thread_num () + 384;
27 #pragma omp parallel
28 if (t != omp_get_thread_num () + 384)
29 abort ();
30 omp_pause_resource_all (omp_pause_hard);
31 #pragma omp parallel
33 if (omp_get_thread_num () != 0 && t != 128)
34 abort ();
35 t = omp_get_thread_num () + 512;
37 #pragma omp parallel
38 if (t != omp_get_thread_num () + 512)
39 abort ();
40 return 0;