On 01.04.2008, at 02:03, malcom wrote:
This is what I've made (suppose you receive a data from a multithreaded socket).

1) You receive the packet
2) Put it into a temp array
3) When you reach a number x of messages you can call the save function

The save function repeats these statements for each packet from the array:
1) Perform insertObject in a second managedObject (connected to the
same persistent store)
2) Get the list of objectID of the object and save it to another array
3) When all packets was saved perform linkMessages function into main
thread passing the objectids array

According to <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html#//apple_ref/doc/uid/TP40003385-SW3 > you can only pass ObjectIDs to another thread if the managed objects were saved. I've never used saving in another object context,
I don't know if it is causing another headache ...

Maybe it is easier to just pass the data to the main thread and perform
the insertion only in the main context?

The recent thread <http://www.cocoabuilder.com/archive/message/cocoa/2008/3/30/202687 > has
some interesting posts on this topic.


Cheers,

felix

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to