Chapter Contents

Previous

Next
sigchk

sigchk



Check for Asynchronous Signals

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
EXAMPLE
SEE ALSO


SYNOPSIS

#include <lcsignal.h>

void sigchk(void);


DESCRIPTION

sigchk is called to check for the occurrence of asynchronous signals. If a signal is pending and not blocked, it is handled by the handler defined by your program or by the default handler if none is defined. If more than one signal is pending and not blocked, they are processed in the order in which they occurred. However, for signals managed by USS, the order in which they are discovered is determined by USS. In this case, the first signal processed is not necessarily the one that occurred first.

Since asynchronous signals are discovered only when a function is called or returns, sigchk is useful for discovering these signals in portions of code that do not call functions (for example, in the middle of a lengthy calculation).

You can use the sigchk function to check for the occurrence of any signal, whether managed by SAS/C or by USS. When a SAS/C handler is defined for a signal, the timing of signal discovery is the same for signals generated by USS as it is for signals generated by SAS/C. That is, the signal is discovered only during a function call, a function return, or a call to sigchk . However, if default handling is specified for an USS signal, this action occurs as soon as the signal is generated.


RETURN VALUE

No information is returned by sigchk . It is not possible to determine directly whether any signals were handled.


IMPLEMENTATION

sigchk is a built-in function; that is, it is implemented by compiler-generated code rather than as a true subroutine call. If no signals are pending when sigchk is called, only two instructions are executed.


EXAMPLE

This code fragment uses sigchk to perform iterative computations and checks for signals every 100 iterations:

#include <lcsignal.h>

for (i = 0; i < 10000; ) {
   for (j = 0; j < 100; ++j,++i) {

      /* Perform calculations. */
   .
   .
   .
   }
sigchk();
}


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.