C++ Standard Library C++ STL Library

C++ - <csignal> (signal.h)



The C++ <csignal> header defines functions, types and macros to handle signals. Some running environments use signals to inform running processes of certain events. These events may be related to errors performed by the program, like a wrong arithmetical operation or a exceptional situation, such as a request to interrupt the program. A signal can report some exceptional behavior within the program, or a signal can report some asynchronous event outside the program.

These functions, types and macros are available to use in a current program after including the header file using - #include <csignal> or #include <signal.h>. All functions, types and macros of this header file are listed below:

Library Functions

TypesDescription
signal() Sets a signal handler for particular signal.
raise() Runs the signal handler for particular signal.

Library Types

TypesDescription
sig_atomic_t Integer type that can be accessed as an atomic entity from an asynchronous signal handler.

Library Macros

Signal handlers

MacrosDescription
SIG_DFL
SIG_IGN
Defines signal handling strategies.
SIG_ERR Returns value of signal specifying that an error was encountered.

Signal types

MacrosDescription
SIGABRT
SIGFPE
SIGILL
SIGINT
SIGSEGV
SIGTERM
Defines signal types