• 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: Using OSMemoryBarrier() with KVO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using OSMemoryBarrier() with KVO


  • Subject: Re: Using OSMemoryBarrier() with KVO
  • From: Paul Thomas <email@hidden>
  • Date: Wed, 23 Apr 2008 19:32:06 +0100


On 23 Apr 2008, at 03:41, Ken Thomases wrote:

On Apr 22, 2008, at 6:37 AM, Paul Thomas wrote:

Is this enough? Or will I need to use a full blown lock?

What is it that you fear going wrong, such that you think even OSMemoryBarrier is necessary?

I think the barrier is needed to ensure that when other threads see done == YES, they can be certain that the other members are set and will not be changed.


What I didn't show in the code, but is implied, is the threads trying to access the result by checking done.

  if( [promise isDone] )
    return [promise result];
  else
    [promise observeValue... etc.

Anyway, I missed a hole. It requires an atomic 'observeIfNotDone' which means I need a lock. Premature optimisation and all that...

Thanks for you help (both),
pt.
_______________________________________________

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: 
 >Using OSMemoryBarrier() with KVO (From: Paul Thomas <email@hidden>)
 >Re: Using OSMemoryBarrier() with KVO (From: Ken Thomases <email@hidden>)

  • Prev by Date: awakeFromInsert rules: ok to fetch and create other managed objects?
  • Next by Date: Re: "Safe" frameworks for privileged tools?
  • Previous by thread: Re: Using OSMemoryBarrier() with KVO
  • Next by thread: Carriage returns and NSXMLParser
  • Index(es):
    • Date
    • Thread