Re: @synchronized([someObject class])
Re: @synchronized([someObject class])
- Subject: Re: @synchronized([someObject class])
- From: Chris Suter <email@hidden>
- Date: Tue, 19 Jun 2007 21:52:13 +1000
On 19/06/2007, at 9:13 PM, Ruotger Skupin wrote:
Hi,
is it possible to do @synchronized([someClass class])?
Yes.
The way @synchronised works is that it synchronises anything that has
the same pointer value of whatever is in the brackets. It doesn't
matter what the type between the brackets is, so long as it's a pointer.
The source code for objc_sync_enter (which is what @synchronized
uses) is available if you want to see how it works.
For the example you used, you could probably also use something like:
@synchronized(@"elementTypesSynchronization")
which would be slightly more efficient although in the unlikely event
that you're worried about performance, you might consider using a
more efficient locking mechanism.
- Chris
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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