• 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: Sat, 08 Dec 2012 08:35:56 -0800

On Dec 7, 2012, at 8:38 PM, Marco S Hyman <email@hidden> wrote:

> On Dec 7, 2012, at 8:18 PM, Steve Sisak <email@hidden> wrote:
>
>> I'm interested if there are an any issued I'm missing in the Obj-C, @synchronized(self), instance variable case.
>
>
> Your pattern can fail if this line
>        _someDictionary = temp;
> isn't atomic.

The real issue with double-checked locking is whether the compiler promises to generate the proper memory barriers such that other threads are guaranteed to see the assignment to _someDictionary *after* the object has been constructed. C makes no such guarantee; other threads might see a non-nil value for _someDictionary before the first thread is done constructing the object.

--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: Steve Sisak <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>)

  • Prev by Date: PDFKit two page display differs from Preview
  • Next by Date: Re: Layers in NSCollectionView (solved)
  • Previous by thread: Re: How to implement readonly property
  • Next by thread: Re: How to implement readonly property
  • Index(es):
    • Date
    • Thread