0

I have some legacy code using NSConfinementConcurrency for its CoreData and I switch the use of them to NSPrivateQueueConcurrencyType or NSMainQueueConcurrencyType.

Any there any issues or risks switching from NSConfinementConcurrencyType to NSPrivateQueueConcurrencyType and NSMainQueueConcurrencyType that one should be aware of?

Usama
  • 1,945
  • 1
  • 13
  • 20
Boon
  • 40,656
  • 60
  • 209
  • 315

1 Answers1

0

NSMainQueueConcurrencyType creates a context that is associated with the main dispatch queue and thus the main thread. You could use such a context to link it to objects that are required to run on the main thread, for example UI elements.

NSPrivateQueueConcurrencyType creates and manages a private dispatch queue to operate on. You must use the new methods performBlock: or performBlockAndWait:. The context will then execute the passed blocks on its own private queue.

Finally, NSConfinementConcurrencyType is the default type and can be used only within the thread where it has been created. So, within your NSOperation, you have used it in the right manner. A simple note. If you want to use it as a child context, you need to have a "queue context" (NSMainQueueConcurrencyType or NSPrivateQueueConcurrencyType).

Divyanshu Sharma
  • 551
  • 2
  • 12