Skip to content

Instantly share code, notes, and snippets.

@OdNairy
Created December 10, 2014 11:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OdNairy/e608d10e0f02f7505958 to your computer and use it in GitHub Desktop.
Save OdNairy/e608d10e0f02f7505958 to your computer and use it in GitHub Desktop.
The real difference between atomic/nonatomic
if (!atomic) {
oldValue = *slot;
*slot = newValue;
} else {
spin_lock_t *slotlock = &PropertyLocks[GOODHASH(slot)];
_spin_lock(slotlock);
oldValue = *slot;
*slot = newValue;
_spin_unlock(slotlock);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment