On 26 May 2009, at 15:51, Joar Wingfors wrote:


On 26 maj 2009, at 07.27, Mike Abdullah wrote:

You've missed the big warning somewhere in the docs that most of AppKit is not threadsafe. Why do you want to create a window on another thread? What is wrong with doing it on the main thread?


Mike,

Your comment is correct in general, but according to the thread safety guidelines you're supposed to be able to create windows on background threads:

<http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#//apple_ref/doc/uid/10000057i-CH12-123364 >

That said, it seems that it's not safe to create views on background threads, so that's at least one thing that's not right in the few lines of code that was quoted.

Wow, I had no idea of this particular aspect of the rules. My suspicion is this exists to accomodate Cocoa's ability to use window objects for caching a view's contents to an image. Maybe the act of showing a window is what is breaking on a secondary thread.

_______________________________________________

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 arch...@mail-archive.com

Reply via email to