diff --git a/src/caffeine/locks_m.f90 b/src/caffeine/locks_m.f90 new file mode 100644 index 000000000..bf21358bd --- /dev/null +++ b/src/caffeine/locks_m.f90 @@ -0,0 +1,36 @@ +! Copyright (c), The Regents of the University of California +! Terms of use are as specified in LICENSE.txt +module locks_m + use iso_c_binding, only: c_intptr_t, c_int, c_bool + + implicit none + private + public :: prif_lock_type, prif_lock, prif_unlock + + type :: prif_lock_type + end type + + interface + + module subroutine prif_lock(image_num, lock_var_ptr, acquired_lock, stat, errmsg, errmsg_alloc) + implicit none + integer(c_int), intent(in) :: image_num + integer(c_intptr_t), intent(in) :: lock_var_ptr + logical(c_bool), intent(out), optional :: acquired_lock + integer(c_int), intent(out), optional :: stat + character(len=*), intent(inout), optional :: errmsg + character(len=:), intent(inout), allocatable, optional :: errmsg_alloc + end subroutine + + module subroutine prif_unlock(image_num, lock_var_ptr, stat, errmsg, errmsg_alloc) + implicit none + integer(c_int), intent(in) :: image_num + integer(c_intptr_t), intent(in) :: lock_var_ptr + integer(c_int), intent(out), optional :: stat + character(len=*), intent(inout), optional :: errmsg + character(len=:), intent(inout), allocatable, optional :: errmsg_alloc + end subroutine + + end interface + +end module locks_m diff --git a/src/caffeine/locks_s.f90 b/src/caffeine/locks_s.f90 new file mode 100644 index 000000000..8380dbc6d --- /dev/null +++ b/src/caffeine/locks_s.f90 @@ -0,0 +1,15 @@ +! Copyright (c), The Regents of the University of California +! Terms of use are as specified in LICENSE.txt +submodule(locks_m) locks_s + + implicit none + +contains + + module procedure prif_lock + end procedure + + module procedure prif_unlock + end procedure + +end submodule locks_s diff --git a/src/prif.f90 b/src/prif.f90 index 520451fd4..05e3edeb9 100644 --- a/src/prif.f90 +++ b/src/prif.f90 @@ -9,5 +9,6 @@ module prif use collective_subroutines_m, only : prif_co_sum, prif_co_max, prif_co_min, prif_co_reduce, prif_co_broadcast use teams_m, only: prif_form_team, prif_change_team, prif_end_team, prif_team_type use synchronization_m, only : prif_sync_all, prif_sync_images, prif_sync_team, prif_sync_memory + use locks_m, only: prif_lock_type, prif_lock, prif_unlock implicit none end module prif