NSoperation的疑惑
来源:互联网 发布:3d免费犀牛怎么编程 编辑:程序博客网 时间:2024/06/16 00:07
使用grant central dispatch queue
// 1) Add to bottom of initWithHTML:delegatebackgroundQueue = dispatch_queue_create("com.razeware.imagegrabber.bgqueue", NULL); // 2) Add to top of deallocdispatch_release(backgroundQueue); // 3) Modify process to be the following- (void)process { dispatch_async(backgroundQueue, ^(void) { [self processHtml]; }); }
其实从某个意义上说nsoperation 是grand central dispatch的一种实现/ 你使用NSOperation实际还是在使用grand dispatch。应为NSoperation给人更多简便的用法:
1. 建立依赖,使得某个NSOPeration依赖/等候在另外一个上面
2. 你可以重排nsoperation,当特殊事件发生的时候。
ASIHTTPrequest内部就大量使用了NSOPERATION;对于比较简单地使用一下多线程的,比如说需要分开的对象资源不多的,那么grant central dispatch就可以了
For this app it’s pretty simple so we just used Grand Central Dispatch directly, no need for the fancy features of NSOperation. But if you need them for your app, feel free to use it!
事实上,目前为止,只是有了基本的多线程概念。前面的路还远着呢
Apple videos Apple videos https://developer.apple.com/videos/
Both WWDC 2010 and 2011 have some videos that are a great introduction to what’s available.
如果你真的想深入学习西,可以看看mike的系列文章: articles on Grand Central Dispatch :::这里简直就是专门研究这个GCD!
https://developer.apple.com/videos/wwdc/2011/... 2011的系列介绍
- NSoperation的疑惑
- 关于 NSOperation 的取消
- NSOperation的用法
- NSOperation的简单使用
- NSOperationQueue 的NSOperation 数
- NSOperation的继承实现
- NSOperation的使用
- NSOperation的使用
- NSOperation的介绍
- NSOperation的基本使用
- NSOperation的其他设置
- 创建异步的NSOperation
- NSOperation的使用细节
- NSOperation多线程的使用
- NSOperation的使用
- NSOperation的高级功能
- NSOperation的使用
- NSOperation的基本用法
- order by 和 group by 的区别
- 五款常用mysql slow log分析工具的比较
- sql 发送邮件
- Visual Studio 行内容 过长自动换行设置
- MySQL查询优化系列讲座之查询优化器
- NSoperation的疑惑
- js中encode、decode的应用说明
- MySQL查询优化--数据类型与效率
- missing break in switch.
- ANT及build.xml文档编写
- Histograms of Oriented Gradients (HOG)理解和源码
- javascript处理json
- DM368 Uboot
- IdentityServlet