objc_atomicCompareAndSwapInstanceVariable
objc_atomicCompareAndSwapInstanceVariable
- Subject: objc_atomicCompareAndSwapInstanceVariable
- From: André Berg <email@hidden>
- Date: Sat, 03 Oct 2009 11:13:02 +0200
Hi,
In <objc/objc-auto.h> I found this functions:
OBJC_GC_EXPORT BOOL objc_atomicCompareAndSwapPtr(id predicate, id
replacement, volatile id *objectLocation)
OBJC_GC_EXPORT BOOL objc_atomicCompareAndSwapInstanceVariable(id
predicate, id replacement, volatile id *objectLocation);
OBJC_GC_EXPORT BOOL objc_atomicCompareAndSwapGlobal(id predicate, id
replacement, volatile id *objectLocation);
This sounds exiting! But I couldn't find any documentation for it other
than the comment in the header.
I presume these work like the functions from libkern
(<libkern/OSAtomic.h>) ?
Can the predicate be any predicate or is it more like OSAtomic...
functions in that it must have some correlation with the value at
objectLocation (replacement will only be set as new value if predicate
and objectLocation are equal, at least that's how I understood what
"man atomic(3)" was saying about the equivalent functions from OSAtomic)?
And how do you pass the objectLocation of an instance variable without
accessing them directly (e.g. "obj->ivar" which will be a hard error in
the future according to compiler warnings)?
Or aren't we supposed to touch those functions at all?
I don't need to know this, just got me interested that's all.
Thanks for reading!
André
_______________________________________________
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