开发者

NSOperationQueue and concurrent operation

开发者 https://www.devze.com 2023-02-04 00:04 出处:网络
As the NSOperationQueue Class Reference said: In iOS, operation queues do not use Grand Central Dispatch to execute operations. They create separate threads for non-concurrent operations and launch co

As the NSOperationQueue Class Reference said: In iOS, operation queues do not use Grand Central Dispatch to execute operations. They create separate threads for non-concurrent operations and launch concurrent operations from the current thread.

Bu开发者_StackOverflow社区t I found in iOS 4.2.1,queue always create threads for concurrent or non-concurrent operations. And I think queue don't care concurrent or non-concurrent at all, because a breakpoint in isConcurrent never be broken. So I think the Reference was wrong...


If you look at the documentation for NSOperation, you should see a note about Mac 10.6 (which roughly corresponds to iOS 4.0) ignoring isConcurrent.

Basically, the only reason to create a concurrent NSOperation would be if you were going to fire it manually.


NSOperationQueue does use GCD. From the documentation:

In iOS 4 and later, operation queues use Grand Central Dispatch to execute operations.

0

精彩评论

暂无评论...
验证码 换一张
取 消