Supplemental Reading for Windows Signal
Source: Dev.to
Signal
Sets interrupt signal handling.
Syntax
void __cdecl *signal(int sig, int (*func)(int, int));
Parameters
sig– Signal value.func– Pointer to the function to be executed. The first parameter of the function is a signal value, and the second parameter is a subcode that can be used when the first parameter isSIGFPE.
Remarks
The signal function enables a process to choose one of several ways to handle an interrupt signal from the operating system. The sig argument is the interrupt to which signal responds; it must be one of the following manifest constants, which are defined in SIGNAL.H.
| sig value | Description |
|---|---|
SIGABRT | Abnormal termination |
SIGFPE | Floating‑point error |
SIGILL | Illegal instruction |
SIGINT | CTRL+C signal |
SIGSEGV | Illegal storage access |
SIGTERM | Termination request |
If sig isn’t one of the above values, the invalid‑parameter handler is invoked, as defined in Parameter validation. If execution is allowed to continue, this function sets errno to EINVAL and returns SIG_ERR.
By default, signal terminates the calling program with exit code 3, regardless of the value of sig.