lock-2.f90 647 B

12345678910111213141516171819202122232425
  1. ! { dg-do run }
  2. use omp_lib
  3. integer (kind = omp_nest_lock_kind) :: lock
  4. logical :: l
  5. l = .false.
  6. call omp_init_nest_lock (lock)
  7. !$omp parallel num_threads (1) reduction (.or.:l)
  8. if (omp_test_nest_lock (lock) .ne. 1) call abort
  9. if (omp_test_nest_lock (lock) .ne. 2) call abort
  10. !$omp task if (.false.) shared (lock, l)
  11. if (omp_test_nest_lock (lock) .ne. 0) l = .true.
  12. !$omp end task
  13. !$omp taskwait
  14. if (omp_test_nest_lock (lock) .ne. 3) l = .true.
  15. call omp_unset_nest_lock (lock)
  16. call omp_unset_nest_lock (lock)
  17. call omp_unset_nest_lock (lock)
  18. !$omp end parallel
  19. if (l) call abort
  20. call omp_destroy_nest_lock (lock)
  21. end