signal | |
Prototype: |
#include <signal.h> void (*signal(int signum, void (*sig_fn)(int signum)))(int signum); -or- typedef void (*TSigFn)(int signum); TSigFn signal(int signum, TSigFn sig_fn); |
General Description: | Register the sig_fn routine to answer signum signal. The default behavior is single shot: the signal handler reverts to the default after getting the first signal. Use sigaction() instead if you want to control the behavior more. |
Return Value: | A positive value if successful. If the thread-create call encountered any errors, the call returns a negative value and sets errno to the error. |
Parameters | |
signum | The signal number to capture. |
sig_fn | The program routine that the schedule calls when the signal |
Possible Errors | |
Examples | |
void sig_handler(int signum) { switch ( signum ) { case SIGFPE: ... } } ... if ( signal(SIGFPE, sig_handler) == 0 ) perror("signal() failed"); |