Chapter Contents

Previous

Next
Signal-Handling Functions

Generating Signals

In the normal execution of a program, signals occur at unpredictable times. As you write and test a program that handles signals, you may want to generate signals to ensure that your program handles them correctly. Your program also may need to generate signals as part of an error-checking routine. For example, a mathematical function may generate a SIGFPOFL signal if it determines that an overflow is certain to occur during its processing.

The library provides three functions for generating signals: raise , siggen , and kill .

If you raise a signal with raise or siggen the handler is called immediately, even if the signal is asynchronous, unless it is a blocked signal managed by USS. Therefore, these functions are not useful for testing signal blocking.

If you use raise or siggen to generate a signal with no special handler defined and the default action is abnormal termination, the program abnormally terminates. However, this abnormal termination may not be exactly the same as it would be if the signal had occurred naturally.

User-defined signals ( SIGUSR1 through SIGUSR8 and SIGASY1 through SIGASY8) can be generated by using raise or siggen . Refer to Chapter 12, "User-Added Signals," in the SAS/C Library Reference, Volume 2 for another method of raising user-defined signals.


Chapter Contents

Previous

Next

Top of Page

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