• 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: Compile error using @synchronized on methods that return values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compile error using @synchronized on methods that return values


  • Subject: Re: Compile error using @synchronized on methods that return values
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 9 Nov 2009 10:56:18 -0800


On Nov 8, 2009, at 12:11 PM, Stuart Malin wrote:

But I suspect that from the posters comments in the post I reference below, it isn't a bug. The problem is, you can't return up the calling chain while being synchronized. Do whatever work it is that needs to be performed in a synchronized way, then return whatever result needs to be returned.

No, that's not true. It's safe to return out of an @synchronized block. It's conceptually the same as a local C++ object whose destructor fires whenever the block exits.


As Clark said, the warning is simply due to a bug in the compiler's control-flow analysis — it doesn't realize that it's safe for the function not to have a 'return' on its last line.

—Jens_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Re: Compile error using @synchronized on methods that return values (From: Stuart Malin <email@hidden>)

  • Prev by Date: Re: NSString of selected text in NSTextView
  • Next by Date: Re: Pausing an NSThread
  • Previous by thread: Re: Compile error using @synchronized on methods that return values
  • Next by thread: Hardware UUID
  • Index(es):
    • Date
    • Thread