raise

Sends a signal to the executing program.

Note

Do not use this method to shut down a Microsoft Store app, except in testing or debugging scenarios. Programmatic or UI ways to close a Store app are not permitted according to the Microsoft Store policies. For more information, see UWP app lifecycle.

Syntax

int raise(
   int sig
);

Parameters

sig
Signal to be raised.

Return value

If successful, raise returns 0. Otherwise, it returns a nonzero value.

Remarks

The raise function sends sig to the executing program. If a previous call to signal has installed a signal-handling function for sig, raise executes that function. If no handler function has been installed, the default action associated with the signal value sig is taken, as follows.

Signal Description Default behavior
SIGABRT Abnormal termination Terminates the calling program with exit code 3
SIGFPE Floating-point error Terminates the calling program
SIGILL Illegal instruction Terminates the calling program
SIGINT CTRL+C interrupt Terminates the calling program
SIGSEGV Illegal storage access Terminates the calling program
SIGTERM Termination request sent to the program Ignores the signal

If the argument isn't a valid signal as specified above, the invalid parameter handler is invoked, as described in Parameter validation. If not handled, the function sets errno to EINVAL and returns a nonzero value.

By default, this function's global state is scoped to the application. To change this behavior, see Global state in the CRT.

Requirements

Routine Required header
raise <signal.h>

For more compatibility information, see Compatibility.

See also

Process and environment control
abort
signal