Re: Using OSMemoryBarrier() with KVO
Re: Using OSMemoryBarrier() with KVO
- Subject: Re: Using OSMemoryBarrier() with KVO
- From: "Shawn Erickson" <email@hidden>
- Date: Tue, 22 Apr 2008 15:15:36 -0700
On Tue, Apr 22, 2008 at 4:37 AM, Paul Thomas <email@hidden> wrote:
> Is this enough? Or will I need to use a full blown lock?
Yes and no... 1) KVO and multiple thread gets ugly quick, 2) using
NSCondition/Lock may make more sense, 3) using just a volatile BOOL
could be enough depending on how lazy the detection of the ivar can
be, 4) look at using OSAtomicXxxx functions [1].
Note OSMemoryBarrier is just an ordering construct (only really
applicable to PowerPC at this time) not an atomic operation or locking
construct.
-Shawn
[1] <http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/chapter_5_section_6.html>
_______________________________________________
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