views:

71

answers:

1

Hello!

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 concurrency problems?

+2  A: 

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(...)).

frenetisch applaudierend