多线程应用(五)——线程操作函数
2015-08-21 17:40
197 查看
#include <stdio.h> #include <stdlib.h> #include <Windows.h> #include <process.h> DWORD WINAPI test(void * p) { int i = 0; while (++i) { printf("%d\n", i); if (i > 100000) { ExitThread(0);//从线程内部退出 } } return 0; } void main() { HANDLE hd = CreateThread(NULL, 0, test, NULL, 0, NULL); system("pause"); SuspendThread(hd);//冻结线程 system("pause"); ResumeThread(hd);//解冻线程 system("pause"); Terminate(hd);//外部退出 system("pause"); }
相关文章推荐
- ETL拉链算法汇总大全
- BZOJ2002: [Hnoi2010]Bounce 弹飞绵羊
- Flume学习(五):Flume Channel Selectors使用
- iOS 怎么自定制推送声音呢?(APP运行时和APP进入后台时)
- 【vim】插件管理及代码智能提示与补全环境的配置
- 聚集索引和非聚集索引速度对比
- Service层的抽象和实现
- Android:实现点击AlertDialog上按钮时不关闭对话框
- 引入Controller
- Java反射机制学习笔记
- mysql带参存储过程
- Container With Most Water
- 重载与覆盖
- BZOJ 3669 魔法森林 LCT
- OutMan——单例模式、代理模式以及iOS沙盒(sandbox)机制
- tomcat部署javaweb项目的三种方式
- 关于volley javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: 错误
- 自定义异常类的使用
- MPIC 与 PowerPC Linux 中断处理
- 導出模板