Core Data + MultiThreading
Core Data + MultiThreading
- Subject: Core Data + MultiThreading
- From: "Rimas M." <email@hidden>
- Date: Tue, 24 Jan 2006 05:04:27 +0200
Hello,
I have got lots of troubles by trying to solve this question. How to
correctly implement multithreading in Core-Data app. I have found
some examples at ADC, and decided to use multiple NSManagedContexts
(each thread has its own context) controlled by ONE
NSPersistanceStoreCoordinator, and locking contexts. Is that a good
decision?
I am trying in this way:
passing to new thread [NSManagedObject objectID] (to identify object
I want to analyze) and [[NSManagedObject managedObjectContext]
persistanceStoreCoordinator];
in new thread creating new managedContext: myContext =
[[NSManagedContext alloc] init]
and setting coordinator to it: [myContext
setPersistanceStoreCoordinator:__the_one_passed_from_parent_thread__];
finally, if I get managedObject by calling objectWithID, it is in
very 'early' stage. I mean - its properties are exactly, what is
configured by creating new object and described in model. There is no
changes, which should be made by awakeFromInsert.
I have tried to call (void)refreshObject:(NSManagedObject *)object
mergeChanges:(BOOL)flag. Nothing.
Object in original context is correct.
What I am doing wrong? Or maybe there is another way to implement
multithreading?
Any suggestions are welcome.
MR.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden