> ~ Online tutorial

<signal.h>
signal.h is a header file defined in the C Standard Library to specify how a program handles signals while it executes. A signal can report some exceptional behavior within the program (such as division by zero), or a signal can report some asynchronous event outside the program (such as someone striking an interactive attention key on a keyboard).

A signal handler can be specified for all but two signals (SIGKILL and SIGSTOP cannot be caught, blocked or ignored). A signal handler is a function that the target environment calls when the corresponding signal occurs. The target environment suspends execution of the program until the signal handler returns or calls longjmp. For maximum portability, an asynchronous signal handler should only:

•    make calls (that succeed) to the function signal
•    assign values to objects of type volatile sig_atomic_t
•    return control to its caller

If the signal reports an error within the program (and the signal is not asynchronous), the signal handler can terminate by calling abort, exit, or longjmp.
Member functions

    int raise(int sig).

This raises a signal artificially.
   psignal(int sig, const char *s),
outputs to stderr a string representation of a signal number. It is in 4.3BSD, Solaris and Linux, but is not specified by POSIX or SUS.
On the same systems, string.h contains the non-standard strsignal(int sig) which operates analogously to strerror.

    void* signal(int sig, void (*func)(int)),

sets the action taken when the program receives the signal sig. If the value of func is SIG_DFL, default handling for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored. Otherwise func points to a signal handler function to be called when the signal occurs.
The function func may terminate by executing a return statement or by calling the abort, exit or longjmp functions. If func executes a return statement, and the value of sig was SIGFPE or any other implementation-defined value corresponding to a computational exception, the behavior is undefined.

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: