16 if (omp_test_lock (&lck
))
18 omp_unset_lock (&lck
);
19 if (! omp_test_lock (&lck
))
21 if (omp_test_lock (&lck
))
23 omp_unset_lock (&lck
);
24 omp_destroy_lock (&lck
);
26 omp_init_nest_lock (&nlck
);
27 if (omp_test_nest_lock (&nlck
) != 1)
29 omp_set_nest_lock (&nlck
);
30 if (omp_test_nest_lock (&nlck
) != 3)
32 omp_unset_nest_lock (&nlck
);
33 omp_unset_nest_lock (&nlck
);
34 if (omp_test_nest_lock (&nlck
) != 2)
36 omp_unset_nest_lock (&nlck
);
37 omp_unset_nest_lock (&nlck
);
38 omp_destroy_nest_lock (&nlck
);
41 if (! omp_get_dynamic ())
44 if (omp_get_dynamic ())
48 if (! omp_get_nested ())
51 if (omp_get_nested ())
54 omp_set_num_threads (5);
55 if (omp_get_num_threads () != 1)
57 if (omp_get_max_threads () != 5)
59 if (omp_get_thread_num () != 0)
61 omp_set_num_threads (3);
62 if (omp_get_num_threads () != 1)
64 if (omp_get_max_threads () != 3)
66 if (omp_get_thread_num () != 0)
69 #pragma omp parallel reduction (|:l)
71 l
= omp_get_num_threads () != 3;
72 l
|= omp_get_thread_num () < 0;
73 l
|= omp_get_thread_num () >= 3;
75 l
|= omp_get_thread_num () != 0;
80 if (omp_get_num_procs () <= 0)
82 if (omp_in_parallel ())
84 #pragma omp parallel reduction (|:l)
85 l
= ! omp_in_parallel ();
86 #pragma omp parallel reduction (|:l) if (1)
87 l
= ! omp_in_parallel ();
95 /* Negative precision is definitely wrong,
96 bigger than 1s clock resolution is also strange. */