On Oct 28, 2016, at 01:37 PM, Jens Alfke <j...@mooseyard.com> wrote:


On Oct 27, 2016, at 8:49 PM, Dave Fernandes <dave.fernan...@utoronto.ca> wrote:
But what managed object are you dealing with? Is the Asset a managed object? If 
so, you can only access its properties from the queue of its managed object 
context. So if it is a main queue context, you can only access the MO’s 
properties from the main queue.

Amen, brother. I design/work on a storage framework with similar thread-safety 
rules (Couchbase Lite) and I can attest that quite a few Cocoa app developers 
seem to add concurrency to their code without giving it enough thought. I’ve 
helped people troubleshoot code where it seems like they just went “this 
operation is blocking the UI so I’ll just use dispatch_async to do it in the 
background”, without understanding the implications for race conditions, or 
following the thread-safety rules of the APIs they’re calling.

I’m not saying that you did this, Steve! Just using this thread as a reminder 
to people that Concurrency is Hard, and you have to think carefully about what 
you’re doing. If you aren’t very aware of what queue/thread every part of your 
code can run on, and what data might be accessible to other queues/threads, 
you’re likely to find yourself in a world of pain at some point.

No, I'm sure I *would* do something like that. :) To me, the CoreData docs are 
just a pile of confusion with no human explanation that I can understand. Maybe 
I should read it again to see if it's been improved recently. Or, more likely, 
I glossed over reading that part back when I started with CoreData because 
IKImageBrowserView took care of creating thumbnails for me, so crap just worked.

Sent from iCloud's ridiculous UI, so, sorry about the formatting

 
_______________________________________________

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

This email sent to arch...@mail-archive.com

Reply via email to