How to let console application continue running after Ctrl+Break ?

How to let console application continue running after Ctrl+Break ?

I have an application which is running some calculations. I would like to handle Ctrl+C or Ctrl+Break so that the application does not stop with "error (69): process interrupted (SIGINT)" after using them.

I tried using SIGNALQQ like this:

use ifport  
  function processBreakSignal ( signum ) ! SIG$INT - CTRL+CSIGNAL  
    !dec$ attributes C :: processBreakSignal  
    integer*4 processBreakSignal  
    integer*2 signum  
  end function  
  function processTerminationSignal ( signum ) ! SIG$TERM - Termination  
    !dec$ attributes C :: processTerminationSignal  
    integer*4 processTerminationSignal  
    integer*2 signum  
  end function  
end interface

status = SIGNALQQ ( SIG$INT, processBreakSignal ) ! SIG$INT 
status = SIGNALQQ ( SIG$TERM, processTerminationSignal ) ! SIG$TERM

integer*4 function processBreakSignal ( signum )  
!dec$ attributes C :: processBreakSignal  
integer*2 signum  
  write(*,'(a)') ' Application is stopping due to Ctrl+C. '  
  write(*,'(a)') ' Please wait until it finishes. '  
  call writeStopSignal()  
  processBreakSignal = 1 ! is return value somehow used?  

The function processBreakSignal which is registered to process the break signal is obviously called, because the message from the function is shown on the screen, but the application stops with the error(69).

Is there any way how to resolve this problem? I have not found information about the return value of the function; could it be the way? I tried 1, 0, -1, but it made no difference.

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.