差异atexit()和at_quick_exit()

时间:2018-05-16 12:28:50

标签: c++ c++11 exit

atexit()at_quick_exit()之间的区别是什么? 我们在atexit()注册的每个函数是否也必须在at_quick_exit()处注册? 例如Phoenix-Singleton自定义函数或其他东西。

1 个答案:

答案 0 :(得分:1)

好吧,来自at_quick_exit

Registers the function pointed to by func to be called on quick program termination (via std::quick_exit). ... The registered functions will not be called on normal program termination. If a function need to be called in that case, std::atexit must be used.

atexit()上调用exit()上注册的功能。在at_quick_exit()上调用在quick_exit()注册的功能 另一个区别是at_quick_exit()可从C ++ 11获得,但在C中不可用。