João Pires
João Pires

Reputation: 1007

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

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?

Upvotes: 2

Views: 543

Answers (2)

Ex-Kyuto
Ex-Kyuto

Reputation: 71

The TerminateProcess Win32 API is equal to kill with SIGKILL signal.

Upvotes: 0

user1143634
user1143634

Reputation:

You should use kill function and SIGKILL signal:

kill(getpid(), SIGKILL);

Upvotes: 6

Related Questions