INTEGER; scalar; INTENT(IN).
Handler: Signal handler (
INTEGER FUNCTION or
If Handler is a an
EXTERNAL routine, arranges for it to be
invoked with a single integer argument (of system-dependent length)
when signal Number occurs.
If Handler is an integer, it can be
used to turn off handling of signal Number or revert to its default
Note that Handler will be called using C conventions,
so the value of its argument in Fortran terms
is obtained by applying
LOC()) to it.
The value returned by
signal(2) is returned.
Due to the side effects performed by this intrinsic, the function form is not recommended.
Warning: If the returned value is stored in
truncation of the original return value occurs on some systems
(such as Alphas, which have 64-bit pointers but 32-bit default integers),
with no warning issued by
g77 under normal circumstances.
Therefore, the following code fragment might silently fail on some systems:
INTEGER RTN EXTERNAL MYHNDL RTN = SIGNAL(signum, MYHNDL) ... ! Restore original handler: RTN = SIGNAL(signum, RTN)
The reason for the failure is that
RTN might not hold
all the information on the original handler for the signal,
thus restoring an invalid handler.
This bug could manifest itself as a spurious run-time failure
at an arbitrary point later during the program's execution,
Warning: Use of the
libf2c run-time library function
(such as via
requires use of the
to pass an
for the Handler argument.
RTN = SIGNAL(signum
SIGNAL is treated as an external procedure
(and resolves, at link time, to
this construct is not valid when
SIGNAL is recognized
as the intrinsic of that name.
Therefore, for maximum portability and reliability,
code such references to the
SIGNAL facility as follows:
INTRINSIC SIGNAL ... RTN = SIGNAL(signum, SIG_IGN)
g77 will compile such a call correctly,
while other compilers will generally either do so as well
or reject the
INTRINSIC SIGNAL statement via a diagnostic,
allowing you to take appropriate action.
For information on other intrinsics with the same name: See Signal Intrinsic (subroutine).