source: trunk/signal-checkpoint/test_sgck1.f90 @ 300

Last change on this file since 300 was 71, checked in by g7moreau, 12 years ago
  • Add exit functional return code
File size: 1.1 KB
RevLine 
[62]1! 2012/04/20 (C) Gabriel Moreau
2!
[65]3! rm sgck_test1 *.o *.mod
4! gfortran -c signal_checkpoint.F90 && gfortran -o sgck_test1 sgck_test1.f90 signal_checkpoint.o
5! ./sgck_test1
[62]6!
[65]7! ps fux | grep ./sgck_test1 | grep -v grep | awk '{print $2}' | xargs kill -USR2
[62]8!
[65]9! ifort -c signal_checkpoint.F90 && ifort -o sgck_test1 sgck_test1.f90 signal_checkpoint.o
[62]10
[65]11program sgck_test1
[62]12
[63]13   use Signal_Checkpoint, only: &
14      signal_checkpoint_connect, &
15      signal_checkpoint_is_received, &
16      signal_checkpoint_received_times, &
[70]17      signal_checkpoint_ask_for_exit_code, &
[69]18      SIGUSR2, &
19      SIGUSR1
[62]20
[63]21   integer :: I
[62]22
[63]23   call signal_checkpoint_connect(SIGUSR2)
[70]24   call signal_checkpoint_connect(SIGUSR1, EXIT=.true.)
[62]25
[63]26   print *, "initialising phase"
[62]27
[63]28   do while (.not. signal_checkpoint_is_received())
29      do I = 1, 15
30         print *, "runnning in the loop ", I, signal_checkpoint_received_times()
31         call sleep (1)
32      end do
33   end do
[62]34
[63]35   print *, "finishing phase"
[70]36
37   if (signal_checkpoint_ask_for_exit_code()) then
[71]38     print *, "stop with exit code 1"
39     stop 1
[70]40   end if
[62]41end program
Note: See TracBrowser for help on using the repository browser.