Linux/POSIX equivalent of Win32 API TerminateProcess in C++ code

Viewed 231

On Linux/POSIX what's the equivalent of

TerminateProcess(GetCurrentProcess(), 0)

I want to be able to abruptly, unorderly terminate a program, no matter if I'm in a thread or not. I don't care about destructors, exit handlers or graceful termination, I just want to completely shutdown / kill the program.

Which system libraries must I include and which function / arguments must I use?

1 Answers

You should use kill function and SIGKILL signal:

kill(getpid(), SIGKILL);
Related