Excellent shutdown of the Xcode program

I am working on a server program in xcode and I want it to be gracefully closed between debug runs. Basically, the next line does not work

std::signal(SIGKILL, [](int){
    printf("got sigkill here!\n"); 
    //shut-down code here
});

I tried to catch other signals, but so far SIGINT, SIGTERM and SIGABRT did not work. How xcode terminates a program if it prints

Program completed with exit code: 9

to the console?

EDIT Apparently, SIGKILL cannot be caught, see this wikipedia entry.

Unlike SIGTERM and SIGINT, this signal cannot be caught or ignored, and the receiving process cannot perform any cleaning, receiving this signal

+1
source share
1 answer

SIGKILL. SIGKILL, . , -, SIGINT. SIGKILL , , , -, .

, printf() , . , .

signal manpage: http://man7.org/linux/man-pages/man7/signal.7.html - printf , .

man-:

, - . POSIX " ". , , undefined.

. : int

+3

All Articles