Changeset 73 for trunk/signal-checkpoint


Ignore:
Timestamp:
May 29, 2012, 2:04:47 PM (12 years ago)
Author:
g7moreau
Message:
  • Cleaning code
  • Rename internal variable
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/signal-checkpoint/signal_checkpoint.F90

    r72 r73  
    1515private
    1616
    17 integer, parameter :: SIGHUP  =  1  ! Signal HUP
    18 integer, parameter :: SIGINT  =  2  ! Signal INT
    19 integer, parameter :: SIGQUIT =  3  ! Signal QUIT
    20 integer, parameter :: SIGUSR1 = 10  ! Signal USR1
    21 integer, parameter :: SIGUSR2 = 12  ! Signal USR2
    22 integer, parameter :: SIGTERM = 15  ! Signal TERM
     17! Signal list
     18integer,parameter :: SIGHUP  =  1  ! Signal HUP
     19integer,parameter :: SIGINT  =  2  ! Signal INT
     20integer,parameter :: SIGQUIT =  3  ! Signal QUIT
     21integer,parameter :: SIGUSR1 = 10  ! Signal USR1
     22integer,parameter :: SIGUSR2 = 12  ! Signal USR2
     23integer,parameter :: SIGTERM = 15  ! Signal TERM
    2324
    2425! Internal counter
    25 integer :: INTERNAL_RECEIVED_COUNT_ = 0       ! Global Signal Counter
    26 logical :: INTERNAL_ERROR_ON_EXIT_  = .false. ! Global State
     26integer :: SIGNAL_RECEIVED_COUNT_ = 0       ! Global signal counter
     27logical :: CODE_ERROR_ON_EXIT_    = .false. ! Global return state
    2728
     29! Public interface
    2830public :: SIGHUP
    2931public :: SIGINT
     
    4244
    4345subroutine signal_checkpoint_connect (SIG_NUM, EXIT)
    44    integer, intent(in) :: SIG_NUM
    45    logical, intent(in), optional :: EXIT
     46   integer,intent(in)          :: SIG_NUM
     47   logical,intent(in),optional :: EXIT
    4648
    4749#ifdef __INTEL_COMPILER
     
    6163      call signal(SIG_NUM, trap_callback_exit_)
    6264   else
    63 
    6465      call signal(SIG_NUM, trap_callback_count_)
    6566   end if
     
    7374   logical :: IS_RECEIVED
    7475
    75    IS_RECEIVED = ( INTERNAL_RECEIVED_COUNT_ > 0 )
     76   IS_RECEIVED = ( SIGNAL_RECEIVED_COUNT_ > 0 )
    7677end function
    7778
     
    8182   integer :: RECEIVED_TIMES
    8283
    83    RECEIVED_TIMES = INTERNAL_RECEIVED_COUNT_
     84   RECEIVED_TIMES = SIGNAL_RECEIVED_COUNT_
    8485end function
    8586
     
    8990   logical :: EXIT
    9091   
    91    EXIT = INTERNAL_ERROR_ON_EXIT_
     92   EXIT = CODE_ERROR_ON_EXIT_
    9293end function
    9394
     
    9596!--------------------------------------------------------------!
    9697
    97 subroutine trap_callback_count_ !(SIG_NUM)
    98    !integer, intent(in) :: SIG_NUM
     98subroutine trap_callback_count_
    9999
    100    INTERNAL_RECEIVED_COUNT_ = INTERNAL_RECEIVED_COUNT_ + 1
     100   SIGNAL_RECEIVED_COUNT_ = SIGNAL_RECEIVED_COUNT_ + 1
    101101end subroutine
    102102
    103103!--------------------------------------------------------------!
    104104
    105 subroutine trap_callback_exit_ !(SIG_NUM)
    106    !integer, intent(in) :: SIG_NUM
     105subroutine trap_callback_exit_
    107106
    108    INTERNAL_ERROR_ON_EXIT_ = .true.
     107   CODE_ERROR_ON_EXIT_ = .true.
    109108   call trap_callback_count_
    110109end subroutine
     
    113112
    114113function trap_callback_intel_exit_ (SIG_NUM) result (ONE)
    115    integer, intent(in) :: SIG_NUM
    116    integer :: ONE
     114   integer,intent(in) :: SIG_NUM
     115   integer            :: ONE
    117116
    118117   call trap_callback_exit_
     
    123122
    124123function trap_callback_intel_count_ (SIG_NUM) result (ONE)
    125    integer, intent(in) :: SIG_NUM
    126    integer :: ONE
     124   integer,intent(in) :: SIG_NUM
     125   integer            :: ONE
    127126
    128127   call trap_callback_count_
Note: See TracChangeset for help on using the changeset viewer.