• 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 from another thread.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindow from another thread.


  • Subject: Re: NSWindow from another thread.
  • From: Steve Checkoway <email@hidden>
  • Date: Sat, 14 Jan 2006 14:04:21 -0800


On Jan 14, 2006, at 4:55 AM, j o a r wrote:


On 14 jan 2006, at 05.41, Steve Checkoway wrote:

I need to send a few messages to an NSWindow from a thread other than the main thread. Are any of these safe to do from the other thread or do I need to use performSelectorOnMainThread:withObject:waitUntilDone: for all of them?

This topic is covered in the official documentation (and of course also in the list archives), please check there first, and get back to the list if you have any follow up questions.


<http://developer.apple.com/cgi-bin/search.pl?q=thread +safety&site=default_collection>

In particular:

<http://developer.apple.com/documentation/Cocoa/Conceptual/ Multithreading/Multithreading.html>

As a general rule; If something is not explicitly documented as thread safe, you can be sure that it isn't.


I have read those documents before. The only relevant part is:

You can create a window on a secondary thread. The Application Kit ensures that the data structures associated with a window are deallocated on the main thread to avoid race conditions. There is some possibility that window objects may leak in an application that deals with a lot of windows concurrently.

So I can create the window. Can I do anything else with it was my question. This is too vague as it is. What do they mean by "create a window"? Does that mean that I can allocate the memory for it or that I may initialize it? How about order it front? This doesn't tell me anything.


As for the archive, I'm not sure if you've tried searching for "Thread" before but every e-mail in the archive contains:
[ Date Prev ][ Date Next ][ Thread Prev ][ Thread Next ][ Date Index ] [ Thread Index ]


Searching for "NSWindow Threads" yields about 100 results, only one thread of which seemed relevant and people posted various replies ranging from the app kit is totally thread-unsafe to the app kit is completely thread-safe to pointing to the same page you did and saying that both statements are false.

I was hoping for something a little more specific like, "You can alloc and init the window in a second thread but everything else has to be done from the main thread."

I hesitate to say this because it sounds ungrateful and I'm actually quite grateful that you've taken the time to respond but I've seen other developers on this list become upset over this so: please don't automatically assume that I haven't read the documentation or searched the archives.

- Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSWindow from another thread.
      • From: j o a r <email@hidden>
References: 
 >NSWindow from another thread. (From: Steve Checkoway <email@hidden>)
 >Re: NSWindow from another thread. (From: j o a r <email@hidden>)

  • Prev by Date: Re: NSWindow keyWindow problem (HELP)
  • Next by Date: Re: Another newbie EXC_BAD_ACCESS in C
  • Previous by thread: Re: NSWindow from another thread.
  • Next by thread: Re: NSWindow from another thread.
  • Index(es):
    • Date
    • Thread