Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Created December 11, 2013 05:46
- (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