| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
! Test handling of detach clause with only a single thread. The runtime |
| 4 |
! should not block when a task with an unfulfilled event finishes |
| 5 |
! running. |
| 6 |
|
| 7 |
program task_detach_2 |
| 8 |
use omp_lib |
| 9 |
|
| 10 |
integer (kind=omp_event_handle_kind) :: detach_event1, detach_event2 |
| 11 |
integer :: x = 0, y = 0, z = 0 |
| 12 |
|
| 13 |
!$omp parallel num_threads (1) |
| 14 |
!$omp single |
| 15 |
!$omp task detach (detach_event1) |
| 16 |
x = x + 1 |
| 17 |
!$omp end task |
| 18 |
|
| 19 |
!$omp task detach (detach_event2) |
| 20 |
y = y + 1 |
| 21 |
call omp_fulfill_event (detach_event1) |
| 22 |
!$omp end task |
| 23 |
|
| 24 |
!$omp task |
| 25 |
z = z + 1 |
| 26 |
call omp_fulfill_event (detach_event2) |
| 27 |
!$omp end task |
| 28 |
!$omp end single |
| 29 |
!$omp end parallel |
| 30 |
|
| 31 |
if (x /= 1) stop 1 |
| 32 |
if (y /= 1) stop 2 |
| 33 |
if (z /= 1) stop 3 |
| 34 |
end program |