Is destructor called if SIGINT or SIGSTP issued?

前端 未结 3 1952
情歌与酒
情歌与酒 2020-12-01 00:08

I have a class with a user-defined destructor. If the class was instantiated initially, and then SIGINT is issued (using CTRL+C in unix) while the program is running, will t

3条回答
  •  被撕碎了的回忆
    2020-12-01 00:56

    If you do not handle these signals yourself, then, no, the destructors are not called. However, the operating system will reclaim any resources your program used when it terminates.

    If you wish to handle signals yourself, then consider checking out the sigaction standard library function.

提交回复
热议问题