sigint: message

This commit is contained in:
ngxson 2024-02-27 21:20:55 +01:00
parent 66c7480a42
commit ac699991a8

View file

@ -2775,7 +2775,10 @@ std::function<void(int)> shutdown_handler;
std::atomic_flag is_terminating = ATOMIC_FLAG_INIT;
inline void signal_handler(int signal) {
if (is_terminating.test_and_set()) {
exit(0); // force exit the process, in case it hangs
// in case it hangs, we can force terminate the server by hitting Ctrl+C twice
// this is for better developer experience, we can remove when the server is stable enough
printf("SIGINT is received second time, exit immediately...\n");
exit(1);
}
shutdown_handler(signal);
}