Skip to content

Instantly share code, notes, and snippets.

@djkskqyr3
Created December 14, 2014 08:26
Show Gist options
  • Save djkskqyr3/aaf9c91f72658ff16fe1 to your computer and use it in GitHub Desktop.
Save djkskqyr3/aaf9c91f72658ff16fe1 to your computer and use it in GitHub Desktop.
With "atomic", the synthesized setter/getter will ensure that a whole value is always returned from the getter or set by the setter, regardless of setter activity on any other thread. That is, if thread A is in the middle of the getter while thread B calls the setter, an actual viable value -- an autoreleased object, most likely -- will be returned to the caller in A.
In nonatomic, no such guarantees are made. Thus, nonatomic is considerably faster than "atomic".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment