Operation queues中多线程的支持

Operation queues usually provide the threads used to run their operations. In OS X v10.6 and later, operation queues use the libdispatch library (also known as Grand Central Dispatch) to initiate the execution of their operations. As a result, operations are always executed on a separate thread, regardless of whether they are designated as concurrent or non-concurrent operations. In OS X v10.5, however, operations are executed on separate threads only if their isConcurrent method returns NO. If that method returns YES, the operation object is expected to create its own thread (or start some asynchronous operation); the queue does not provide a thread for it.

OperationQueues通常提供了运行operationsd的线程。在OS X v10.6之后,operationsQueue使用libdispatch库(GCD)来初始化这些operations的执行逻辑。所以,operations通常是在一个独立的thread中执行,不管它是执行并发还是不支持并发。但是,在OS X v10.5系统中,operations只有在不支持并发的的情况下才使用同一个Thread执行任务,如果isConcurrent返回YES,那么operation object会被安排在各自不同的线程中去执行,operation queue不再提供执行的线程环境。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值