• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSWindow in threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindow in threads


  • Subject: Re: NSWindow in threads
  • From: Joar Wingfors <email@hidden>
  • Date: Tue, 26 May 2009 07:51:25 -0700


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 (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


  • Follow-Ups:
    • Re: NSWindow in threads
      • From: Michael Ash <email@hidden>
    • Re: NSWindow in threads
      • From: Mike Abdullah <email@hidden>
References: 
 >NSWindow in threads (From: Mattias Jansson <email@hidden>)
 >Re: NSWindow in threads (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: NULL Outlets in one file work in another
  • Next by Date: Re: Displaying a number with Quartz
  • Previous by thread: Re: NSWindow in threads
  • Next by thread: Re: NSWindow in threads
  • Index(es):
    • Date
    • Thread