开发者

Advice sought on using NSOperationQueue in IPhone ap

Should an IPhone app ge开发者_StackOverflownerally only use one shared NSOperationQueue, stored in maybe the app delegate, and have each controller put NSOperations into it as needed, or is it ok for each each controller to have its own NSOperationQueue? Are both approaches acceptable?


After skimming through the Concurrency Programming Guide, it looks like both approaches are safe and reasonable. The only consideration I could find that tends towards one over the other is this quote:

If your application has multiple operation queues, each prioritizes its own operations independently of any other queues. Thus, it is still possible for low-priority operations to execute before high-priority operations in a different queue.

If you're concerned about a large number of operations having priority conflicts, then it's probably best to use a single queue to make sure that your priorities take maximum effect. Otherwise, whichever makes more sense in the context of your code is just fine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜