mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-24 14:51:25 +01:00
24 lines
471 B
Fortran
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
|