function std::signal

From Cppwiki

Jump to: navigation, search

The std::signal function sets the characterists for the handling of a given signal value.

std::signal has the following prototype:

#include <csignal>
namespace std {
  ptypedef void (*sig_func_ptr)(int);
  sig_func_ptr signal(int sig, sig_func_ptr new_func);
}
sig
The signal number to modify
new_func
The function to use when the signal is invoked

std::signal returns the previous handler function for the signal. This value should be saved if the program will quit handling the signal at some point, or if signal handler chaining is desired.

Three special sig_func_ptr values are also defined:

SIG_DFL
Use the system's default handler for this signal.
SIG_IGN
Ignore this signal.
SIG_ERR
Not an actual handler, indicates there was a problem with the call to std::signal.

See also: std::raise, <csignal> header

Personal tools