Skip to content

Commit

Permalink
Add new module, locks_m, and add interfaces for prif_lock and
Browse files Browse the repository at this point in the history
`prif_unlock`.
  • Loading branch information
ktras committed Dec 17, 2023
1 parent 3bc6f53 commit 43782ba
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/caffeine/locks_m.f90
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions src/caffeine/locks_s.f90
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/prif.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 43782ba

Please sign in to comment.