On Sep 25, 2008, at 8:50 AM, Roman Kishchenko wrote:

It is said in the documentation that NSMutableData is not thread- safe. So, its access needs to be synchronized, at least, when multiple contending threads are using the object of this class. However, is synchronization necessary when NSMutableData is used by multiple threads NOT concurrently,
i.e. first one thread adds some data to it, the the other, etc?

If you can guarantee that only one thread is accessing the object at a time, then that _is_ synchronization.


Also, is it ok to pass the object of this class as an argument to
performSelector:onThread:...?

Yes, that's safe so long as the calling thread doesn't access the object after it has been passed as an argument (unless such access is synchronized with the receiving thread).

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to