Re: Core-Data Multithreading question about save
Re: Core-Data Multithreading question about save
- Subject: Re: Core-Data Multithreading question about save
- From: "Hamish Allan" <email@hidden>
- Date: Thu, 22 May 2008 00:00:06 +0100
On Wed, May 21, 2008 at 11:36 PM, Dex Morgan <email@hidden> wrote:
> This link actions happend in the main thread (so inside the main object
> context) and the app can't see objects inserted into the second
> managedobject until I perform a -save: to it.
> However it seems to be a damn expensive operation (a save for each inserted
> object I mean) and I think it's not the right way to perform my target.
If you need to create relationships between objects in two different
contexts, you need to synchronize those contexts, which is inherently
expensive.
Do you really need to do this after every object inserted? Could you
do it in bulk?
Do you really need to do the inserts on a separate thread? Could you
have your worker thread call
performSelectorOnMainThread:withObject:waitUntilDone: and have the
main thread perform the inserts at the end of each run loop iteration?
Hamish
_______________________________________________
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