Chapter Contents

Previous

Next
raise

raise



Generate an Artificial Signal

Portability: ISO/ANSI C conforming


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <signal.h>

int raise(int signum);


DESCRIPTION

raise is called to artificially generate a signal. The argument signum is the number of the signal to be generated. You should specify this argument symbolically, using one of the signal names listed in Types of Signal Support. When raise is called, the signal is handled as established by a previous call to signal or by the default handler if signal was not called.

If the raise function is called for a signal managed by USS, raise calls the kill function to generate the signal. Then, if the signal is blocked when raise is called, the signal remains pending until the signal is unblocked. If a signal managed by SAS/C is generated with raise , the handler is always called immediately, regardless of whether the signal is asynchronous or blocked. If you call siginfo in a handler for a signal generated by raise , it always returns NULL .


RETURN VALUE

raise returns 0 if it is successful or a nonzero value if it is not successful. The most common reason that raise fails is that the signum number is not a valid signal.

Note:    raise may not return if the handler for the signal terminates with a call to longjmp , exit , or abort , or if the handler for the signal defaults to abnormal program termination.  [cautionend]


CAUTION

If you use raise to test signal handling in a program, keep in mind that signals generated by raise are treated somewhat differently from signals that occur naturally. Signals other than USS signals that are generated by raise are always handled immediately, so you should not use raise to test signal blocking. You may also encounter problems if you use raise to test the handler for an asynchronous signal because the handler for the signal is executed immediately, not just when a function is called or returns.


EXAMPLE

Refer to the example for siginfo.


RELATED FUNCTIONS

kill , siggen


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

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