• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: @synchronized([someObject class])
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: @synchronized([someObject class])
      • From: "Ken Ferry" <email@hidden>
References: 
 >@synchronized([someObject class]) (From: Ruotger Skupin <email@hidden>)

  • Prev by Date: Re: @synchronized([someObject class])
  • Next by Date: Re: pb with awakeFromNib
  • Previous by thread: Re: @synchronized([someObject class])
  • Next by thread: Re: @synchronized([someObject class])
  • Index(es):
    • Date
    • Thread