• 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: How to implement readonly property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to implement readonly property


  • Subject: Re: How to implement readonly property
  • From: Kyle Sluder <email@hidden>
  • Date: Sun, 09 Dec 2012 08:37:26 -0800

On Dec 9, 2012, at 6:53 AM, Ken Thomases <email@hidden> wrote:

> On Dec 9, 2012, at 1:27 AM, Kyle Sluder wrote:
>
>> If dispatch_once() really is unsuitable for use with a dispatch_once_t
>> stored in Objective-C instance storage, then the correct example in the
>> paper I've cited might be a sufficient workaround.
>
> I thought we had established that, in all sane use cases, an instance variable once predicate is fine.

Hence the hedge. ;-)

> The cases where an instance variable once predicate would be unsafe are exactly the cases where it would be unsafe to access any instance variable, including the isa pointer.  So, if you're using the instance in any way, you've already assumed conditions that make the once predicate fine. (And, hopefully, you've more than assumed it, you've ensured it by proper inter-thread communication of the object pointer.)

Yes, but as Greg pointed out the real danger comes from not understanding all the nuances of this, and assuming that dispatch_once is a more powerful synchronization primitive than it really is.

--Kyle Sluder

_______________________________________________

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

  • Follow-Ups:
    • Re: How to implement readonly property
      • From: Ken Thomases <email@hidden>
References: 
 >Re: How to implement readonly property (From: Steve Sisak <email@hidden>)
 >Re: How to implement readonly property (From: Ken Thomases <email@hidden>)
 >Re: How to implement readonly property (From: Steve Sisak <email@hidden>)
 >Re: How to implement readonly property (From: Marco S Hyman <email@hidden>)
 >Re: How to implement readonly property (From: Kyle Sluder <email@hidden>)
 >Re: How to implement readonly property (From: Steve Sisak <email@hidden>)
 >Re: How to implement readonly property (From: Kyle Sluder <email@hidden>)
 >Re: How to implement readonly property (From: Steve Sisak <email@hidden>)
 >Re: How to implement readonly property (From: Greg Parker <email@hidden>)
 >Re: How to implement readonly property (From: Richard Heard <email@hidden>)
 >Re: How to implement readonly property (From: Kyle Sluder <email@hidden>)
 >Re: How to implement readonly property (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: How to implement readonly property
  • Next by Date: Re: How to implement readonly property
  • Previous by thread: Re: How to implement readonly property
  • Next by thread: Re: How to implement readonly property
  • Index(es):
    • Date
    • Thread