开发者

Multiple NSOperationQueues?

I would like to use NSOperations in my application to resolve threading problems. I have read some tutorials and now I know what I have to do, but I have a problem. There is a must to have the same NSOperationQueue in each class. What if I use a new NSOperationQueue in each class. There will be conc开发者_如何转开发urrency problems?


You only have concurrency issues if you access a resource from more than one thread. If your operations do not share some resources you should be fine, even with more than one NSOperationQueue running (NSOperationQueue does internally run more than one thread anyway).

If you share one NSOperationQueue across multiple threads, you should probably synchronize calls to it (using @synchronized(...)).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜