OpenMP-Examples/sources/Example_atomic.2.f
2020-06-26 07:54:45 -07:00

26 lines
722 B
Fortran

! @@name: atomic.2f
! @@type: F-fixed
! @@compilable: yes
! @@linkable: no
! @@expect: success
! @@version: omp_3.1
function atomic_read(p)
integer :: atomic_read
integer, intent(in) :: p
! Guarantee that the entire value of p is read atomically. No part of
! p can change during the read operation.
!$omp atomic read
atomic_read = p
return
end function atomic_read
subroutine atomic_write(p, value)
integer, intent(out) :: p
integer, intent(in) :: value
! Guarantee that value is stored atomically into p. No part of p can change
! until after the entire write operation is completed.
!$omp atomic write
p = value
end subroutine atomic_write