Re: FileWrapper & iCloud
Re: FileWrapper & iCloud
- Subject: Re: FileWrapper & iCloud
- From: Dave Fernandes <email@hidden>
- Date: Sat, 01 Dec 2012 20:00:31 -0500
On 2012-12-01, at 5:05 PM, Mike Abdullah <email@hidden> wrote:
> On 1 Dec 2012, at 20:21, Dave Fernandes wrote:
>
>>> NSPersistentDocument always creates a MOC of type NSMainQueueConcurrencyType, even if it is created on a background thread. So as long as things don't go wrong during document opening, everything will be the same as a document opened on the main thread forever after.
>>
>> Whoops! I meant to say NSPersistentDocument always creates a MOC of type **NSConfinementConcurrencyType** -- the legacy type that assumes you know what you are doing and will manage access accordingly.
>
> But the Core Data team have said for years that MOCs created on the main thread get some special treatment.
I guess I missed that somewhere. Was it on this list?
> Of course they’ve never given us any specifics. The docs state very clearly that MOCs (using the non-private queue types) should be created on the same thread/queue that they’ll be used on.
They do say that clearly, and if you follow that you are less likely to get into trouble; but they go on to explain that you *can* access a MOC from different threads as long as you take responsibility for serializing access. ("If You Don’t Use Thread Containment" section from the Core Data Programming Guide)
With concurrent opening, there is no way to use NSLocking in the background thread if the frameworks are not doing it for you, but since you only get hold of the MOC after the background thread has completed its work, you should not need to lock from that point on.
-d
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden