Re: -threadDictionary thread safety?
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