mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
26 lines
486 B
Fortran
26 lines
486 B
Fortran
! @@name: lock_owner.1f
|
|
! @@type: F-fixed
|
|
! @@compilable: yes
|
|
! @@linkable: yes
|
|
! @@expect: success
|
|
program lock
|
|
use omp_lib
|
|
integer :: x
|
|
integer (kind=omp_lock_kind) :: lck
|
|
|
|
call omp_init_lock (lck)
|
|
call omp_set_lock(lck)
|
|
x = 0
|
|
|
|
!$omp parallel shared (x)
|
|
!$omp master
|
|
x = x + 1
|
|
call omp_unset_lock(lck)
|
|
!$omp end master
|
|
|
|
! Some more stuff.
|
|
!$omp end parallel
|
|
|
|
call omp_destroy_lock(lck)
|
|
end
|