Re: NSPrivateQueueConcurrencyType working outside of performBlock
Re: NSPrivateQueueConcurrencyType working outside of performBlock
- Subject: Re: NSPrivateQueueConcurrencyType working outside of performBlock
- From: Mike Abdullah <email@hidden>
- Date: Sat, 01 Aug 2015 14:12:05 +0100
> On 29 Jul 2015, at 15:35, Trygve Inda <email@hidden> wrote:
>
>>
>> “Setter methods on queue-based managed object contexts are thread-safe. You
>> can invoke these methods directly on any thread”
>>
>> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/CoreData
>> Framework/Classes/NSManagedObjectContext_Class/index.html
>>
>
>
> In Apple's example, they use two different contexts, each with their own
> NSPersistentStoreCoordinator. But the NSPersistentStoreCoordinators each
> point to the same store file URL.
>
> Where is it documented that this works?
>
> If the NSPersistentStoreCoordinator instances are separate, how does it
> actually work when they are both writing to the same store (potentially at
> the same time)?
>
> All Apple's notes say is:
>
> To ensure that the application can remain responsive during this operation,
> the view controller employs a second coordinator to manage interaction with
> the persistent store. It configures the coordinator to use the same managed
> object model and persistent store as the main coordinator vended by the
> stack controller.
I can’t recall where it’s documented specifically, but this is supported. The PSCs then rely on SQLite's locking of the file on disk to manage access to it.
_______________________________________________
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