Raise the SIGABRT signal to terminate program execution
#include <stdlib.h> void abort( void );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The abort() function causes abnormal process termination to occur by means of the function call raise(SIGABRT), unless the signal SIGABRT is caught and the signal handler doesn't return. If the signal SIGABRT is caught and the signal handler returns, the signal handler is removed and raise(SIGABRT) is called again. Note that prior to calling raise(), abort() ensures that SIGABRT isn't ignored or blocked.
The abort() function doesn't return to its caller.
#include <stdlib.h> int main( void ) { int major_error = 1; if( major_error ) abort(); /* You'll never get here. */ return EXIT_SUCCESS; }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Read the Caveats |
Thread | Yes |
A strictly-conforming POSIX application can't assume that the abort() function is safe to use in a signal handler on other platforms.
atexit(), close(), execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), _exit(), exit(), getenv(), main(), putenv(), sigaction(), signal(), spawn*() functions, system(), wait(), waitpid()