Debian Codegraph @

libgomp/testsuite/libgomp.fortran/rwlock_2.f90

raw
1 ! { dg-do run }
2 ! Insert a unit into cache at the beginning, then start multiple
3 ! threads to access the same unit concurrency, unit will be found in unit cache during the read lock phase.
4 ! This test case is used to test the read lock when access unit cache and list.
5 program main
6 use omp_lib
7 implicit none
8 integer:: thread_id, total_threads, i, j
9 total_threads = omp_get_max_threads ()
10 open (10, file='tst.dat', asynchronous="yes")
11 !$omp parallel private (thread_id, i, j)
12 do i = 1, 100
13 thread_id = omp_get_thread_num ()
14 do j = 1, 100
15 write (10, *, asynchronous="yes") thread_id, i
16 end do
17 end do
18 !$omp end parallel
19 ! call inquire with file parameter to test find_file in unix.c
20 call flush ()
21 close (10, status="delete")
22 end program