The difference between atomic and nonatomic:
Atomic: When setting the @property property of a member variable, the default is atomic, which provides multithreading security. Because of multithreading, all objects in the operation of the member variables are synchronous, so, in order to prevent an object in the operation of data is not finished by another object snatched by the tampering,atomic for this provides a multi-threaded security mechanism, the use of synchronous locking method to control the process of ownership. That is: {lock}//The first object gets the operation data, locks its own process, others can not be robbed before I release the lock.
if (Property! = newvalue) {
[Property release];
property = [NewValue retain];
}
{unlock}//After the object has finished manipulating the data, the synchronization lock is released, and someone else can get the data to do their own work. Description: The lock must be unique.nonatomic:When setting the @property property of a member variable, set Nonatomic to prohibit multithreading. This directly eliminates the possibility of tampering by the other side of the data operation. This setting is generally used if it is not multi-threaded.
The difference between objective-c:atomic and nonatomic