atexit函数 exit 和_exit 的区别
来源:互联网 发布:空手道数据集 编辑:程序博客网 时间:2024/05/22 14:01
进程退出方式:
1.正常结束:
1)main 函数结束;
2)exit(3) 结束:调用atexit (3) , on_exit (3) 函数.
All open stdio(3) streams are flushed and closed. Files created by tmpfile(3) are removed.
3)_exit(2) 结束:不会调用atexit on_exit函数
The function _exit() terminates the calling process "immediately". Any open file descriptors belong‐
ing to the process are closed; any children of the process are inherited by process 1, init, and the
process's parent is sent a SIGCHLD signal.
2.非正常结束:
1)信号结束:
2)abort函数:实际上也是给发送一个SIGABRT信号.
atexit函数的测试代码:
#include <iostream>#include <stdlib.h>using namespace std;void atexit1(){ cout << "in 1" << endl;}void atexit2(){ cout << "in 2" << endl;}int main(){ atexit(atexit1); atexit(atexit2); cout << "before end" << endl; return -1;}./testretval
before end
in 2
in 1
阅读全文
0 0
- atexit函数 exit 和_exit 的区别
- exit()和atexit()函数
- atexit() 和 exit() 函数
- exit和return的区别以及atexit()函数
- atexit函数和exit函数的理解
- atexit函数和exit函数的理解
- return、exit和_exit的区别+atexit
- 浅析exit()和atexit()函数
- atexit函数的调用与exit函数和_exit函数的区别
- c++常用函数学习--------exit() 与atexit()的区别:
- 结束程序函数exit、 _exit、 atexit区别
- exit、 _exit、 atexit区别
- exit与atexit区别
- C++中的atexit函数和exit函数
- Linux中exit()函数和atexit函数
- C++中的exit()和atexit()函数
- exit()和atexit()
- exit和_exit,atexit
- Eclipse——内存溢出设置
- C++容器适配器
- 二分图最优匹配之KM算法
- Caffe: 贾扬清2015年讲座
- Java IO知识点总结一(File类)
- atexit函数 exit 和_exit 的区别
- 利用RandomAccessFile对文件进行切割存储
- 机器学习-监督学习
- OpenMV人脸识别
- java Map 学习笔记
- Mybatis集成Spring MVC,使用Spring test进行测试
- NOIP2017模拟赛(14) 总结
- 数组排序
- sflowtrend 简单查看 二层口子里面的流量