After dealing with MOCs and queues for a while, I'm still unsure I understand how to use MOCs with queues the right way. I'll address each type of MOC separately:
NSMainQueueConcurrencyType
This one is actually easy. It says that has to run on the main queue. This can be achieved using [context performBlock:block] or by using it directly form the main thread.
If your code is executing on the main thread, you can invoke methods on the main queue style contexts directly instead of using the block based API.
NSConfinementConcurrencyType
that context will not be used by any thread other than the one on which you created it
What does that mean about queues, even serial ones that don't promise to use the same thread all the time?
NSPrivateQueueConcurrencyType
The context creates and manages a private queue
Do I have to use this queue for all processing via [context performBlock:block]?
Can I just use it directly from within a single serial queue that I defined in a fashion similar to NSMainQueueConcurrencyType?
Or in other words, is it safe to do the following:
NSOperationQueue *workQueue = [[NSOperationQueue alloc] init];
workQueue.maxConcurrentOperationCount = 1;
[workQueue addOperationWithBlock:^{
// It just creates a new MOC with some parent
_context = [SUDataManager createChildContext];
// .... Do things with context without [_context performBlock:block]...
}];