function
<csignal>

raise

int raise (int sig);
Generates a signal
Sends signal sig to the current executing program.

The signal is handled as specified by function signal.

Parameters

sig
The signal value to raise. The following macro constant expressions identify standard signal values:

macrosignal
SIGABRT(Signal Abort) Abnormal termination, such as is initiated by the abort function.
SIGFPE(Signal Floating-Point Exception) Erroneous arithmetic operation, such as zero divide or an operation resulting in overflow (not necessarily with a floating-point operation).
SIGILL(Signal Illegal Instruction) Invalid function image, such as an illegal instruction. This is generally due to a corruption in the code or to an attempt to execute data.
SIGINT(Signal Interrupt) Interactive attention signal. Generally generated by the application user.
SIGSEGV(Signal Segmentation Violation) Invalid access to storage: When a program tries to read or write outside the memory it is allocated for it.
SIGTERM(Signal Terminate) Termination request sent to program.

Each library implentation may provide additional signal value macro constants to be used with this function.

Return Value

Returns zero if successful, and a value different from zero otherwise.

Data races

Concurrently calling this function is safe, causing no data races.
Note though that its handling process may affect all threads.

Exceptions (C++)

If no function handlers have been defined with signal to handle the raised signal, the function never throws exceptions (no-throw guarantee).
Otherwise, the behavior depends on the particular library implementation.

See also