• 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: Properties and memory management with overrides.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Properties and memory management with overrides.


  • Subject: Re: Properties and memory management with overrides.
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 26 Jan 2009 17:15:29 -0800

On Jan 26, 2009, at 16:26, Bill Bumgarner wrote:

However, even if only one thread can be changing the data, atomicity still matters. If the accessors aren't atomic, multiple read-only users of the data (in different threads) might get completely bogus results. This problem *can* be solved by atomicity at the property level, if you're prepared to take the potential performance hit from implementing it.

Actually, it really can't be solved at the property level. Individual properties can generally never carry enough information about themselves to know what the "right" behavior is in the face of threads.


Example:

Indeed. In general, accessing a property can have 3 possible outcomes:

1. The right value.

2. A wrong value.

3. Complete and utter garbage.

Atomicity can eliminate the last case only. In general, that doesn't solve any problems at all, but in practice it might.

Any notification-driven system (even single-threaded) can present an observer with a temporarily inconsistent data model (as in your firstName/lastName example). Therefore, observers should typically be coded defensively with regard to outcome #2 anyway. Coding defensively against outcome #3 is unlikely to practicable. *That's* the problem I meant can be solved by atomicity.

_______________________________________________

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: Properties and memory management with overrides. (From: Ben Trumbull <email@hidden>)
 >Re: Properties and memory management with overrides. (From: "Sean McBride" <email@hidden>)
 >Re: Properties and memory management with overrides. (From: Quincey Morris <email@hidden>)
 >Re: Properties and memory management with overrides. (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: CoreData silently failing to insert?
  • Next by Date: Re: Not Resolving Aliases
  • Previous by thread: Re: Properties and memory management with overrides.
  • Next by thread: Re: Properties and memory management with overrides.
  • Index(es):
    • Date
    • Thread