• 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 produces warning on messages to super
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: @synchronized produces warning on messages to super


  • Subject: Re: @synchronized produces warning on messages to super
  • From: Shawn Erickson <email@hidden>
  • Date: Wed, 25 Jan 2006 10:42:06 -0800

On 1/25/06, Shaun Wexler <email@hidden> wrote:
> On Jan 25, 2006, at 8:24 AM, Shawn Erickson wrote:
>
> > On 1/25/06, Jonathan del Strother <email@hidden> wrote:
> >> I found an oddity in @synchronized() behaviour - it produces warnings
> >> on any messages to super that appear after the @synchronized
> >> directive.   As a trivial (and nonsensical) example :
> >>
> >> @synchronized(@"blah") {}
> >
> > Are you really synchronizing against a string constant?
>
> I don't see a problem with that,

You point out the issue with using a locally defined string constant
in the rest of your comment.

> especially if it's a unique/global object.  @synchronized utilizes a small pool of mutexes which are indexed by a hash of the object pointer.

If you have the following code...

MyReader.m
@synchronized(@"BufferModificatoinMutex") { ... }

MyWriter.m
@synchronized(@"BufferModificatoinMutex") { ... }

The string constants used above have different addresses because each
lives in a different object file so each block of code is not
synchronizing against the same mutex which is likely what someone
would assume at first pass over the code. ...hence my question.

-Shawn
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >@synchronized produces warning on messages to super (From: Jonathan del Strother <email@hidden>)
 >Re: @synchronized produces warning on messages to super (From: Shawn Erickson <email@hidden>)
 >Re: @synchronized produces warning on messages to super (From: Shaun Wexler <email@hidden>)

  • Prev by Date: orderFrontCharacterPalette works... but with one potentially untenable requirement
  • Next by Date: Re: NSView setFrameSize
  • Previous by thread: Re: @synchronized produces warning on messages to super
  • Next by thread: NSPanel question
  • Index(es):
    • Date
    • Thread