Skip to content

Instantly share code, notes, and snippets.

@fjolnir fjolnir/atomic.mm Secret
Created Dec 11, 2013

Embed
What would you like to do?
- (void)setFoo:(id)aFoo
{
id old = _foo;
if(OSAtomicCompareAndSwapPtr(old, aFoo, &_foo)) {
[aFoo retain];
[old release];
}
else
[self setFoo:aFoo];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.