Core data and threading
Core data and threading
- Subject: Core data and threading
- From: Frédéric Testuz <email@hidden>
- Date: Fri, 21 Jul 2006 16:14:07 +0200
Hello,
I have Core Data Document-based Application. With the application I
have an import method to recover data from csv text (from an Excel
sheet).
In the first version, the method took near 10 minutes to import a
thousand line. I optimized the method and now it took less than 30
seconds. It's a good result but I still have the spinoff cursor. Then
I think I have to place the import method in a second thread. But I
have never work with thread and with reading documentation I have
some questions
In the Core Data Programming Guide it's said that we need a Managed
Object Context and a Persistent Store Coordinator for each thread if
we are doing concurrent operations. But now I'm a little lost.
In my NSPersistentDocument subclass I have a Managed Object Context
(moc1). It had its own Persistent Store Coordinator (psc1). But when
the doc is new (before first save), psc1 has no Persistent Store.
How can I make a moc2 and a psc2 which point to the same data ?
And when I have finished to import the csv text, how I inform moc1 of
the new data to have them show in the window ?
Or since the user cannot interact with the window during the
importing, there is no concurrent operations and I can use two moc
but one psc ? But then I think I have to use -lock in the psc ?
If someone can help me, thank you.
Frédéric _______________________________________________
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