Operation Queues 面向对象的封装
Operation Queues
An operation queue is the Cocoa equivalent of a concurrent dispatch queue and is implemented by the NSOperationQueue
class. Whereas dispatch queues always execute tasks in first-in, first-out order, operation queues take other factors into account when determining the execution order of tasks. Primary among these factors is whether a given task depends on the completion of other tasks. You configure dependencies when defining your tasks and can use them to create complex execution-order graphs for your tasks.
The tasks you submit to an operation queue must be instances of the NSOperation
class. An operation object is an Objective-C object that encapsulates the work you want to perform and any data needed to perform it. Because the NSOperation
class is essentially an abstract base class, you typically define custom subclasses to perform your tasks. However, the Foundation framework does include some concrete subclasses that you can create and use as is to perform tasks.
Operation objects generate key-value observing (KVO) notifications, which can be a useful way of monitoring the progress of your task. Although operation queues always execute operations concurrently, you can use dependencies to ensure they are executed serially when needed.
For more information about how to use operation queues, and how to define custom operation objects, see Operation Queues.
https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/ConcurrencyandApplicationDesign/ConcurrencyandApplicationDesign.html#//apple_ref/doc/uid/TP40008091-CH100-SW8
最新文章
- SymmetricDS 快速和灵活的数据库复制
- Codeforces Round #361 (Div. 2) B
- 第二章 JavaScript语法·
- google搜索技巧汇总
- 转:python webdriver API 之简单对象的定位
- HashMap循环遍历方式及其性能对比(zhuan)
- c++ swap 函数
- OpenShare文档中心
- CUDA获取显卡数据
- 从3dmax中导入模型到UDK Editor(供个人备忘)
- hadoop笔记之hdfs shell操作
- C#深复制与浅复制
- UVa 136 - Ugly Numbers
- ACM Let the Balloon Rise
- [Abp 源码分析]七、仓储与 Entity Framework Core
- JavaScript—面向对象开发详解和垃圾回收
- Django Admin初识
- [sharepoint]修改Item或者File的Author和Editor
- 提高delete效率方法
- Vuex 页面刷新后store保存的数据会丢失 取cookie值