NSOperation、NSOperationQueue浅析
来源:互联网 发布:mac装win7后usb驱动 编辑:程序博客网 时间:2024/04/29 21:22
最近在研究NSOperation、NSOperationQueue这2个类,其中走了不少的弯路,特此记录下来,一给自己增加印象,二给后来学习者提供点有用的资料。
NSOperation是个抽象类,并不能直接拿来用,要用得先继承它。苹果封装了NSInvocationOperation和NSBlockOperation这两个类,如果这两个类不能满足要求,我们也可以自己直接继承NSOperation,写个自己的操作类。
首先看NSOperation类中有个实例方法 - (void)cancel; 一开始以为可以取消所有的操作,但是实践证明,该方法只能取消已加入队列中,但还未运行的操作, 已经正在运行的操作是不能取消的。另NSInvocationOperation单独执行,不加入队列中,执行- (void)start; 方法是同步执行的,只有加入队列中才会并发执行。
NSOperationQueue其实就是个线程池,负责管理加入队列中的操作。队列中的操作是并发执行的。
1 0
- NSOperation、NSOperationQueue浅析
- NSOPeration NSOperationQueue
- NSOperation NSOperationQueue
- iOS多线程开发——NSOperation/NSOperationQueue浅析
- Cocoa:NSOperation和NSOperationQueue
- Cocoa:NSOperation和NSOperationQueue
- NSOperation和NSOperationQueue
- Cocoa: NSOperation和NSOperationQueue
- Cocoa:NSOperation和NSOperationQueue
- NSOperation和NSOperationQueue
- NSOperation and NSOperationQueue教程
- NSOperation和NSOperationQueue
- Cocoa:NSOperation和NSOperationQueue
- NSOperation和NSOperationQueue
- NSOperation/NSOperationQueue small demo
- NSOperation和NSOperationQueue
- NSOperation和NSOperationQueue
- Cocoa:NSOperation和NSOperationQueue
- C++数据类型:基本数据类型 构造数据类型(自定义数据类型)
- Sate210-F 金手指核心板引脚说明
- Ruby, 真是有很多魔力一样的东西在里面啊。
- 何处是归程
- HDU 2084 数塔 DP
- NSOperation、NSOperationQueue浅析
- php使用哈希表API
- Worldwind配置文档
- [Jweb] Servlet/jsp HTTP协议, 第一个抓取页面的程序,先启动 tomcat 得,端口号8888!
- C++简单文件的输入/输出
- apache并发量及注意点
- 无线简单网络模型模拟
- fastcgi_param 详解
- 【GUI组件】ComboBox