Re: NSEnumerator retaining objects?
Re: NSEnumerator retaining objects?
- Subject: Re: NSEnumerator retaining objects?
- From: j o a r <email@hidden>
- Date: Wed, 9 Mar 2005 13:49:59 +0100
On 2005-03-09, at 13.26, Shaun Wexler wrote:
It is completely related to it, because NSEnumerator operates on
mutable collections and may get called from multiple threads.
But again, NSEnumerator doesn't operate on collections that are being
mutated, so I think that this whole subtopic of discussion is moot. It
doesn't matter if the collection is mutated from the same thread, or a
different thread, both cases are equally illegal.
My point is that retain/autorelease performed by NSEnumerator is
redundant;
I have not argued with that. I don't know how it is implemented so I
can't say for sure, but it feels like it shouldn't be needed. I think
we agree on this point.
returning a pointer to an object already retained by its collection is
unnecessary within the current thread's context, WRT -nextObject.
Going beyond a single-threaded app's needs may require additional
measures to manage object lifetimes. A properly written application
will not be broken if the retain/autorelease pair were removed from
the NSEnumerator nextObject implementation, and most Cocoa apps should
benefit from the performance increase.
I might not be reading you correctly, but it sounds to me like you are
talking about retain/release as having anything to do with thread
safety? If NSEnumerator uses retain+autorelease it's definitively not
in any attempt at thread safety.
j o a r
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