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.

Mattias: You should review the thread safety documentation carefully, and consider if you're in compliance or not. Note that if something isn't called out to be safe to use on background threads, you should assume that it's not. The creation of you UI isn't typically thread safe, and it's also in general not the type of work that you'd need to offload to background threads. It's probably better to set up the UI on the main thread, and only perform work for your underlying data model in the background - That's likely where you have most need for computing power in any case.

j o a r


_______________________________________________

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