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

Last change on this file since 214 was 71, checked in by g7moreau, 12 years ago
  • Add exit functional return code
File size: 1.1 KB
Line 
1! 2012/04/20 (C) Gabriel Moreau
2!
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
6!
7! ps fux | grep ./sgck_test1 | grep -v grep | awk '{print $2}' | xargs kill -USR2
8!
9! ifort -c signal_checkpoint.F90 && ifort -o sgck_test1 sgck_test1.f90 signal_checkpoint.o
10
11program sgck_test1
12
13   use Signal_Checkpoint, only: &
14      signal_checkpoint_connect, &
15      signal_checkpoint_is_received, &
16      signal_checkpoint_received_times, &
17      signal_checkpoint_ask_for_exit_code, &
18      SIGUSR2, &
19      SIGUSR1
20
21   integer :: I
22
23   call signal_checkpoint_connect(SIGUSR2)
24   call signal_checkpoint_connect(SIGUSR1, EXIT=.true.)
25
26   print *, "initialising phase"
27
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
34
35   print *, "finishing phase"
36
37   if (signal_checkpoint_ask_for_exit_code()) then
38     print *, "stop with exit code 1"
39     stop 1
40   end if
41end program
Note: See TracBrowser for help on using the repository browser.