The int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) function defined in #include specifies the action which should be taken when a signal is received. The sigaction() function provides an interface for reliable signals in replacement of the unreliable and deprecated signal() function.
Signal handlers installed by the signal() interface will be uninstalled immediately prior to execution of the handler. Permanent handlers must therefore be reinstalled by a call to signal() during the handler's execution, causing unreliability in the event a signal of the same type is received during the handler's execution but before the reinstall. Handlers installed by the sigaction() interface can be installed permanently and a custom set of signals can be blocked during the execution of the handler. These signals will be unblocked immediately following the normal termination of the handler (but not in the event of an abnormal termination such as a C++ exception throw.)
To catch(...) signals translated into C++ exceptions, special compiler switches may be necessary on some platforms such as -fnon-call-exceptions for the gcc compiler.
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Sigaction (Unix)".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world