• 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: Windows on main thread always only sometimes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Windows on main thread always only sometimes?


  • Subject: Re: Windows on main thread always only sometimes?
  • From: Michael Ash <email@hidden>
  • Date: Fri, 3 Jul 2009 00:09:31 -0400

On Thu, Jul 2, 2009 at 2:16 PM, Jack Repenning<email@hidden> wrote:
> I've always been taught that one must only create and run AppKit objects on
> the main thread. Recently, though, over in objc-language,
>
>  http://lists.apple.com/archives/Objc-language/2009/Jul/msg00002.html
>
> it was pointed out that the threading Programming Guide seems to say
> otherwise:
>
>>
>> <http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html>
>> says:
>> "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. You can create a modal window on a secondary thread. The
>> Application Kit blocks the calling secondary thread while the main thread
>> runs the modal loop."
>
> But now I notice this only says you can *create* windows from secondary
> threads; it doesn't explicitly allow any other action, and it even refers to
> several automatic insurances that other things happen on the main thread.
>
> So what *are* the rules? Is the Thread Safety Summary implicitly strict,
> "you can create a window, but absolutely nothing else"? Or is there some set
> of other operations that are permitted from the secondary (and where do I
> learn those)?

The ironclad rule of thread safety is that if it's not *explicitly*
documented to be thread safe, then it's not.

Thus, all of these other things that the docs don't explicitly refer
to aren't safe to do.

Mike
_______________________________________________

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

References: 
 >Windows on main thread always only sometimes? (From: Jack Repenning <email@hidden>)

  • Prev by Date: Replace -[NSKeyedUnarchiver unarchiveObjectWithData:] so it doesn't crash on corrupt archive
  • Next by Date: Re: documenting bindings (was: Re: Dynamically loading a part of a Window in Cocoa)
  • Previous by thread: Windows on main thread always only sometimes?
  • Next by thread: Private copy not working correctly
  • Index(es):
    • Date
    • Thread