Portability Function: Causes a subroutine to begin execution after a specified amount of time has elapsed.
Module: USE IFPORT
Syntax
Results
The return value is INTEGER(4). It is zero if no alarm is pending. If an alarm is pending (has already been set by a previous call to ALARM), it returns the number of seconds remaining until the previously set alarm is to go off, rounded up to the nearest second.
After ALARM is called and the timer starts, the calling program continues for time seconds. The calling program then suspends and calls proc, which runs in another thread. When proc finishes, the alarm thread terminates, the original thread resumes, and the calling program resets the alarm. Once the alarm goes off, it is disabled until set again.
If proc performs I/O or otherwise uses the Fortran library, you need to compile it with one of the multithread libraries.
The thread that proc runs in has a higher priority than any other thread in the process. All other threads are essentially suspended until proc terminates, or is blocked on some other event, such as I/O.
No alarms can occur after the main process ends. If the main program finishes or any thread executes an EXIT call, than any pending alarm is deactivated before it has a chance to run.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also
Example
USE IFPORT
INTEGER(4) numsec, istat
EXTERNAL subprog
numsec = 4
write *, "subprog will begin in ", numsec, " seconds"
ISTAT = ALARM (numsec, subprog)