Next: , Previous: AINT, Up: Intrinsic Procedures


8.10 ALARM — Execute a routine after a given delay

Description:
ALARM(SECONDS [, STATUS]) causes external subroutine HANDLER to be executed after a delay of SECONDS by using alarm(1) to set up a signal and signal(2) to catch it. If STATUS is supplied, it will be returned with the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm.
Option:
gnu
Class:
subroutine
Syntax:
CALL ALARM(SECONDS, HANDLER) CALL ALARM(SECONDS, HANDLER, STATUS)
Arguments:

SECONDS The type of the argument shall be a scalar INTEGER. It is INTENT(IN).
HANDLER Signal handler (INTEGER FUNCTION or SUBROUTINE) or dummy/global INTEGER scalar. INTEGER. It is INTENT(IN).
STATUS (Optional) STATUS shall be a scalar INTEGER variable. It is INTENT(OUT).

Example:
          program test_alarm
            external handler_print
            integer i
            call alarm (3, handler_print, i)
            print *, i
            call sleep(10)
          end program test_alarm
     

This will cause the external routine handler_print to be called after 3 seconds.