On May 31, 2012, at 8:59 PM, Antonio Nunes wrote: > Couldn't we just [[NSObject alloc] init]? I think @synchronized cares about > pointer uniqueness, not about the class, no? (And, as I learned from this, > under ARC the pointer should also actually respond to memory management > methods, i.e. be a real object, which is satisfied simply by it pointing to > an object of class NSObject.)
In cases where I need a global lock for use by a particular class, I just use the class object: @synchronized([MyClass class]) { … } (don't use [self class] because it can have different values if there are any subclasses.) —Jens
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com