aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/task-detach-1.f90
blob: c53b1ca0029a79d39d4a0863f6e0909e723bd098 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
! { dg-do run }

! Test chaining of detached tasks, with each task fulfilling the
! completion event of the previous one.

program task_detach_1
  use omp_lib

  integer (kind=omp_event_handle_kind) :: detach_event1, detach_event2
  integer :: x = 0, y = 0, z = 0

  !$omp parallel
    !$omp single
      !$omp task detach (detach_event1)
        x = x + 1
      !$omp end task

      !$omp task detach (detach_event2)
        y = y + 1
	call omp_fulfill_event (detach_event1)
      !$omp end task

      !$omp task
        z = z + 1
	call omp_fulfill_event (detach_event2)
      !$omp end task
    !$omp end single
  !$omp end parallel

  if (x /= 1) stop 1
  if (y /= 1) stop 2
  if (z /= 1) stop 3
end program