Changeset 70
- Timestamp:
- May 25, 2012, 6:16:35 PM (13 years ago)
- Location:
- trunk/signal-checkpoint
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/signal-checkpoint/signal_checkpoint.F90
r68 r70 26 26 ! False public, only for trap procedure 27 27 integer, public :: INTERNAL_RECEIVED_COUNT_ = 0 ! Global Counter 28 integer, public :: INTERNAL_ERROR_ON_EXIT_ = 0 29 integer, public :: INTERNAL_SIGNAL_EXIT_ = 0 28 30 29 31 public :: SIGHUP … … 36 38 public :: signal_checkpoint_is_received 37 39 public :: signal_checkpoint_received_times 40 public :: signal_checkpoint_ask_for_exit_code 38 41 39 42 !--------------------------------------------------------------! … … 41 44 !--------------------------------------------------------------! 42 45 43 subroutine signal_checkpoint_connect (SIG_NUM )46 subroutine signal_checkpoint_connect (SIG_NUM, EXIT) 44 47 integer, intent(in) :: SIG_NUM 48 logical, intent(in), optional :: EXIT 49 45 50 46 51 #ifdef __INTEL_COMPILER 47 52 integer :: ERR 48 53 54 if (present(EXIT)) then 55 INTERNAL_SIGNAL_EXIT_ = SIG_NUM 56 end if 57 49 58 ERR = signal(SIG_NUM, signal_checkpoint_trap_callback_intel_, -1) 50 59 #endif … … 52 61 #ifdef __GNUC__ 53 62 intrinsic signal 63 64 if (present(EXIT)) then 65 INTERNAL_SIGNAL_EXIT_ = SIG_NUM 66 end if 54 67 55 68 call signal(SIG_NUM, signal_checkpoint_trap_callback_gfortran_) … … 75 88 76 89 !--------------------------------------------------------------! 90 91 function signal_checkpoint_ask_for_exit_code () result (EXIT) 92 logical :: EXIT 93 94 EXIT = ( INTERNAL_ERROR_ON_EXIT_ /= 0 ) 95 end function 96 97 !--------------------------------------------------------------! 77 98 end module 78 99 !--------------------------------------------------------------! … … 88 109 integer, intent(in) :: SIG_NUM 89 110 111 ! print *, "SIG1 : ", SIG_NUM 112 ! if (SIG_NUM == INTERNAL_SIGNAL_EXIT_) then 113 ! print *, "SIG2 : ", INTERNAL_SIGNAL_EXIT_ 114 ! INTERNAL_ERROR_ON_EXIT_ = 1 115 ! print *, "SIG3 : ", INTERNAL_SIGNAL_EXIT_ 116 ! end if 90 117 INTERNAL_RECEIVED_COUNT_ = INTERNAL_RECEIVED_COUNT_ + 1 91 118 end subroutine … … 98 125 integer :: ONE 99 126 127 ! if (SIG_NUM == INTERNAL_SIGNAL_EXIT_) then 128 ! INTERNAL_ERROR_ON_EXIT_ = 1 129 ! end if 100 130 INTERNAL_RECEIVED_COUNT_ = INTERNAL_RECEIVED_COUNT_ + 1 101 131 ONE = 1 -
trunk/signal-checkpoint/test_sgck1.f90
r69 r70 15 15 signal_checkpoint_is_received, & 16 16 signal_checkpoint_received_times, & 17 signal_checkpoint_ask_for_exit_code, & 17 18 SIGUSR2, & 18 19 SIGUSR1 … … 21 22 22 23 call signal_checkpoint_connect(SIGUSR2) 23 call signal_checkpoint_connect(SIGUSR1 )24 call signal_checkpoint_connect(SIGUSR1, EXIT=.true.) 24 25 25 26 print *, "initialising phase" … … 33 34 34 35 print *, "finishing phase" 36 37 if (signal_checkpoint_ask_for_exit_code()) then 38 stop 1 39 end if 35 40 end program
Note: See TracChangeset
for help on using the changeset viewer.