XBeach
|
00001 ! provides subroutine myusleep(n) 00002 ! sleeps for n microseconds 00003 module sleeper 00004 #if __GFORTRAN__ 00005 use, intrinsic :: iso_c_binding 00006 implicit none 00007 save 00008 interface 00009 subroutine usleep(i) bind(C,name='usleep') 00010 import 00011 integer(c_int), value :: i 00012 end subroutine usleep 00013 end interface 00014 #else 00015 implicit none 00016 save 00017 #endif 00018 private 00019 public:: myusleep 00020 00021 contains 00022 #if __GFORTRAN__ 00023 subroutine myusleep(i) 00024 integer, intent(in) :: i 00025 call usleep(i) 00026 end subroutine myusleep 00027 #elif __INTEL_COMPILER 00028 subroutine myusleep(i) 00029 integer, intent(in) :: i 00030 integer j 00031 j = i/1000 00032 j = max(1,j) 00033 call sleepqq(j) 00034 end subroutine myusleep 00035 #elif __PGI 00036 subroutine myusleep(i) 00037 integer, intent(in) :: i 00038 integer j 00039 j = i/1000 00040 j = max(1,j) 00041 call sleepqq(j) 00042 end subroutine myusleep 00043 #else 00044 subroutine myusleep(i) 00045 ! this is the final resort: do not sleep at all 00046 integer, intent(in) :: i 00047 integer j 00048 j = i/1000000 00049 j = max(0,j) 00050 ! j = max(1,j) ! will sleep for one second 00051 call sleep(j) 00052 end subroutine myusleep 00053 #endif 00054 00055 end module sleeper