SIGNALQQ and SIGINT won't let the application continue running

SIGNALQQ and SIGINT won't let the application continue running

jirina's picture

I have an application which tries to handle interrupt signals. I use SIGNALQQ for that, so it goes like this in my code:

        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

The function processBreakSignal reads:

        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?

When I run my application, the message from the function is shown on the screen, but the application is then stopped with the error (69): process interrupted (SIGINT). If I want the application to continue, what should I do? Can I influence the behavior of the application by changing the return value of the function?

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