What happens when you close a c++ console application

前端 未结 4 616
南笙
南笙 2020-11-28 12:00

I guess the question says it all, but, what happens if someone closes a c++ console app? As in, clicks the \"x\" in the top corner. Does it instantly close? Does it throw so

4条回答
  •  臣服心动
    2020-11-28 12:35

    On Linux and other Unix systems, the console runs as a separate process. As you close the shell, it sends the SIGHUP signal to the currently active process or processes that are not executed in the background. If the programmer does not handle it, the process simply terminates. The same signal is sent if you close the SSH session with a terminal and an active process.

提交回复
热议问题