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 (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]