• 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: -threadDictionary thread safety?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -threadDictionary thread safety?


  • Subject: Re: -threadDictionary thread safety?
  • From: Michael Ash <email@hidden>
  • Date: Fri, 6 Feb 2009 21:14:48 -0500

On Fri, Feb 6, 2009 at 6:05 PM, A.M. <email@hidden> wrote:
> Hello,
>
> Now that 10.5 allows one to maintain pointers to threads other than the
> current thread, is it legal to call -threadDictionary for the non-current
> thread? I ask because it is odd that Cocoa would allow access to address
> space that the standard pthread_key/specific API would not allow.

A strict reading of the documentation would indicate that it is safe
to call this method, as NSThread is marked as thread safe. However it
would not be safe to then do anything with the return value, because
NSMutableDictionary is not. Worse yet, it wouldn't even be safe to use
the return value *from the thread it belongs to*, since it's globally
visible.

Practically speaking, I would say that it's only safe to use it from
the thread it belongs to. I would definitely file a bug with Apple
requesting that this be clarified, though.

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: 
 >-threadDictionary thread safety? (From: "A.M." <email@hidden>)

  • Prev by Date: Re: Animated toolbar
  • Next by Date: Re: Read lines from very large text file
  • Previous by thread: -threadDictionary thread safety?
  • Next by thread: Internships available at The Omni Group
  • Index(es):
    • Date
    • Thread