Re: Core data fetch and multithreading
Re: Core data fetch and multithreading
- Subject: Re: Core data fetch and multithreading
- From: Hunter Hillegas <email@hidden>
- Date: Mon, 22 Nov 2010 07:58:07 -0800
I think someone somewhere told me that if you create a MOC on the main thread, there's some special runloop integration that is included, hence one of the reasons it's important to not create one on the main thread and then pass it around.
This is also important to keep in mind re: NSOperation, since it's init is called on the main thread.
http://www.duckrowing.com/2010/03/11/using-core-data-on-multiple-threads/
On Nov 22, 2010, at 12:16 AM, Quincey Morris wrote:
> I think maybe you have more design options here. For example, you can [in principle, I think] multithread with a single MOC without locks if you pass "ownership" of the MOC around between threads that make changes, so that ownership serializes access. That requires the ownership passing to be thread safe, and you already have [I think] the perfect mechanism for that: GCD. You'd probably also want to break down your background operations so that enumeration of the relationship doesn't take place within a single GCD block execution, but where each block execution is one iteration of the enumeration. (Isn't that more GCD-like anyway?)
_______________________________________________
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