• 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: Synchronizing Thread Execution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Synchronizing Thread Execution


  • Subject: Re: Synchronizing Thread Execution
  • From: Alastair Houghton <email@hidden>
  • Date: Tue, 5 Dec 2006 19:02:37 +0000

On 5 Dec 2006, at 15:25, Scott Ribe wrote:

Note that you'd want to make sure that this string is unique within
your code

Actually, if it really just needs a pointer, then:

 static int foo;
 ...
 @synchronized(&foo)
 ...

Problem is, even though the current implementation just goes off the pointer
value, the documentation does state " The @synchronized() directive takes as
its only argument any Objective-C object...". But then a couple of
paragraphs later it uses the selector _cmd, and selectors are *NOT*
Objective-C objects.

AFAIK it does NSStringFromSelector(_cmd), which returns an NSString, which
*is* an Objective-C object.


Your point---that you shouldn't rely on @synchronized() just working on the
basis of a pointer---is, however, very valid. If you rely on that, you might
break on any future ObjC implementation (maybe even the 64-bit one that's
coming in Leopard).


Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________

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: Synchronizing Thread Execution
      • From: Scott Ribe <email@hidden>
References: 
 >Re: Synchronizing Thread Execution (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: Re: Sub classing.
  • Next by Date: 10.4 date format help
  • Previous by thread: Re: Synchronizing Thread Execution
  • Next by thread: Re: Synchronizing Thread Execution
  • Index(es):
    • Date
    • Thread