mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-23 22:31:22 +01:00
36 lines
591 B
Fortran
36 lines
591 B
Fortran
! @@name: task_detach.1
|
|
! @@type: F-free
|
|
! @@operation: compile
|
|
! @@expect: success
|
|
! @@version: omp_5.0
|
|
program main
|
|
use omp_lib
|
|
implicit none
|
|
|
|
external :: async_work, work
|
|
|
|
logical :: async=.true.
|
|
integer(omp_event_handle_kind) :: event
|
|
|
|
!$omp parallel
|
|
!$omp masked
|
|
|
|
!$omp task detach(event)
|
|
|
|
if(async) then
|
|
call async_work(omp_fulfill_event, event)
|
|
else
|
|
call work()
|
|
call omp_fulfill_event(event)
|
|
endif
|
|
|
|
!$omp end task
|
|
!! Other work
|
|
|
|
!$omp taskwait
|
|
|
|
!$omp end masked
|
|
!$omp end parallel
|
|
|
|
end program
|