mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
24 lines
465 B
Fortran
24 lines
465 B
Fortran
! @@name: taskyield.1f
|
|
! @@type: F-free
|
|
! @@compilable: yes
|
|
! @@linkable: no
|
|
! @@expect: success
|
|
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
|