Re: "Use them from only one thread at a time"
Re: "Use them from only one thread at a time"
- Subject: Re: "Use them from only one thread at a time"
- From: Sean McBride <email@hidden>
- Date: Thu, 19 May 2011 18:06:17 -0400
- Organization: Rogue Research Inc.
On Thu, 19 May 2011 14:31:23 -0700, Quincey Morris said:
>On May 19, 2011, at 13:56, Sean McBride wrote:
>
>>> Would it be correct to restate it
>>> like this…
>>>
>>> "In most cases, although you can allocate instances of these classes on
>>> any thread, each instance must receive messages only from the thread
>>> which allocated it."
>>
>> I believe so.
>
>I don't believe so.
Did you look at the classes listed under that section?
<http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/
Multithreading/ThreadSafetySummary/ThreadSafetySummary.html>
NSMutableData is one. If Apple's wording is correct, that means I can't
create two threads, each of which creates and manipulates its *own*
NSMutableData instances (but doesn't share these objects with other
threads!). That just seems unlikely to me. How could you ever use
NSMutableData on a non-main thread if so? Who's to say some OS-created
thread is not also using NSMutableData?
I do think Jerry is right; they mean you can create NSMutableDatas on
any thread, as long as you don't share the instances with other threads.
>> See also:
>> <http://www.mikeash.com/pyblog/friday-qa-2009-01-09.html>
>
>While I don't think there's anything actually inaccurate in that blog
>post, I remember thinking when I first read it that Mike hadn't really
>disentangled the different strands of the problem. As a result, I think
>this post is useful only for sounding alarm bells, not for figuring out
>a way to silence them.
It was only suggested reading on the topic....
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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