00001
00002
00003
00004 #include <omp.h>
00005 #include <stdlib.h>
00006
00007 int
00008 main (void)
00009 {
00010 int i = 6, n = 0;
00011 omp_set_dynamic (0);
00012 omp_set_nested (1);
00013 #pragma omp parallel shared (i) num_threads (3)
00014 {
00015 if (omp_get_num_threads () != 3)
00016 #pragma omp atomic
00017 n += 1;
00018 #pragma omp parallel shared (i) num_threads (4)
00019 {
00020 if (omp_get_num_threads () != 4)
00021 #pragma omp atomic
00022 n += 1;
00023 #pragma omp critical
00024 i += 1;
00025 }
00026 }
00027 if (n == 0 && i != 6 + 3 * 4)
00028 abort ();
00029 return 0;
00030 }