Chapter Contents |
Previous |
Next |
Signal-Handling Functions |
sigchk
is called to discover pending asynchronous signals.
You can
insert calls to
sigchk
in your program to decrease the number of statements that are
executed before a signal is discovered.
exit
and
longjmp
. Using these facilities bypasses
return to the operating system, which causes unpredictable results. By limiting
signal discovery (and signal handling) to times when the library has control,
the library permits you to use all of the facilities of C, including
longjmp
and
exit
. (For some signals under CMS, I/O also would not be available to
handlers if they were called immediately.)
++elements; table[elements] = value;
Delaying Discovery of Signals |
For many applications, coding a
signal handler is complicated
by the possibility that a new signal may be generated during the handler's
execution (either the same signal or a completely unrelated signal). For POSIX
applications, the
sigaction
function makes
it easy to block signals during the execution of a signal handler. For non-POSIX
applications, the situation is more complicated, and it may be difficult to
block asynchronous signals during the execution of a signal handler. To assist
in the writing of reliable code, the SAS/C library suppresses the discovery
of new asynchronous signals within a handler. An exception is when the handler
calls
sigchk
,
signal
, or
sigaction
, which indicates
its readiness to handle new signals. This applies only to asynchronous signals;
for example, if a handler divides by 0, the resulting signal cannot be delayed
no matter how convenient that might be. Also, any signals that are pending
while a handler executes are discovered and processed when the handler returns.
Waiting for Signals |
pause
,
sigpause
, and
sigsuspend
suspend execution until a signal is received
ecbpause
and
ecbsuspend
wait
for either a signal or for an
Event Control Block (ECB) to be posted
sleep
and
sleepd
suspend execution until a signal is received
or an elapsed time interval expires. If a signal is received while program
execution is suspended by one of these functions, the signal is handled immediately,
unless the signal is blocked.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.