PThread使用方法
来源:互联网 发布:显卡内存多大合适知乎 编辑:程序博客网 时间:2024/06/06 00:24
void *task(void *data) {
//验证传参
printf(“验证传参值:%s”, (char *)data);
//耗时操作
for (int i = 0; i < 20000; i++) {
NSLog(@”执行次数:%d”, i);
}
return NULL;
}
//子线程
- (IBAction)executeTimingOperationByPthread:(id)sender {
//1.创建子线程对象
/*参数一:指定pthread_t类型的子线程地址
参数二:指定线程特定属性(占用内存空间)
参数三:函数声明
参数四:传给上面函数的参数
*/
pthread_t pthread;
char *data = “Hello”;
pthread_create(&pthread, NULL, task, data);
//2.把耗时操作给子线程执行
}
0 0
- pthread使用方法
- PThread使用方法
- pthread的基本使用方法
- pthread-win32库编译及使用方法注意事项
- pthread-win32库编译及使用方法注意事项
- pthread-win32库编译及使用方法注意事项
- Pthread
- pthread
- pthread
- PThread
- pthread
- pthread
- pthread
- pthread
- pthread
- pthread
- pthread
- pthread
- 计算两个日期间的时间差
- MAC下安装与配置MySQL
- java学习日记_45:应用类型作为形式参数。
- 分时系统
- 弹出dialog时点击其他处不消失
- PThread使用方法
- async中流程控制的applyEach,applyEachSeries,compose, during的用法
- 图像重构问题
- 数据结构之解析ArrayList源码的add,remove,set,contains
- 文章标题
- 运用python提取文本信息实战-rdoq time matching
- iOS 高德地图SDK 批量创建大头针
- navigationBar设置
- Codeforces Round #362 (Div. 2)D. Puzzles