多线程总结(代码)
来源:互联网 发布:淘宝cpu散片哪家好 编辑:程序博客网 时间:2024/06/07 00:26
(1)[NSThread detachNewThreadSelector:@selector(createTableview) toTarget:self withObject:nil];
(2)[self performSelectorInBackground:@selector(createTableview) withObject:nil];
(3)
NSThread *thread = [[NSThread alloc]initWithTarget:self selector:@selector(createTableview) object:nil];
[thread setName:@"HelloThread"];
[thread setStackSize:4 * 1024];//提供4KB的整数倍
[thread setThreadPriority:1.0f];//优先级配置,从0到1不等的浮点数,分别表示CPU在空闲时分配资源给线程执行任务的优先度,0最小,1最大.
[thread start];
(4)
NSOperation (线程队列)控制并发数
NSInvocationOperation *operation = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(createTableview) object:nil];
[operation start];//单独建立它在主线程
(5)
//GCD大中央调度中心
dispatch_queue_t main = dispatch_get_main_queue();//主队列,串行队列一个
dispatch_async(main, ^{
[self createTableview];
});
- 多线程总结(代码)
- 安卓中多线程断点续传文件下载核心代码总结
- 多线程代码
- 多线程代码
- 多线程总结--多线程介绍
- 多线程_多线程总结
- 多线程总结
- 多线程总结
- 多线程总结
- 多线程总结
- 多线程总结
- 多线程总结
- 多线程总结
- 多线程总结
- 多线程总结:
- 多线程总结
- 多线程总结
- 多线程总结
- poj-1338-Ugly Numbers
- Eclipse快捷键大全(转载)
- scsi debugging
- 一种减少索引下载/切换总时间的技巧
- MVC4 apiController 过滤器ActionFilterAttribute的注意事项
- 多线程总结(代码)
- 【SSH三大框架】Spring基础第一篇:搭建Spring环境、实例化Bean、管理Bean的作用域以及Bean的生命周期
- split的坑
- Ubuntu搭建LAMP环境
- send和sendto的区别
- Follow ML projiect
- 程序员出发了
- 网络包出错概率
- UML中的关联