OpenMP-Examples/tasking/sources/taskyield.1.f90
2022-11-04 09:35:42 -07:00

24 lines
471 B
Fortran

! @@name: taskyield.1
! @@type: F-free
! @@operation: compile
! @@expect: success
! @@version: omp_3.1
subroutine foo ( lock, n )
use omp_lib
integer (kind=omp_lock_kind) :: lock
integer n
integer i
do i = 1, n
!$omp task
call something_useful()
do while ( .not. omp_test_lock(lock) )
!$omp taskyield
end do
call something_critical()
call omp_unset_lock(lock)
!$omp end task
end do
end subroutine