aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/rwlock_3.f90
blob: 1906fcd7a0b030f9c183c988354c1395a7e036ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
! { dg-do run }
! Find or create the same unit number in concurrency,
! at beginning, threads cannot find the unit in cache or unit list,
! then threads will acquire the write lock to insert unit.
! This test case is used to ensure that no duplicate unit number will be
! inserted into cache nor unit list when same unit was accessed in concurrency.
program main
  use omp_lib
  implicit none
  integer:: i
  !$omp parallel private (i)
    do i = 1, 100
      open (10, file='tst.dat', asynchronous="yes")
      ! Delete the unit number from cache and unit list to stress write lock.
      close (10, status="delete")
    end do
  !$omp end parallel
end program