Nonatomic non-atomic properties are non-thread safe, suitable for small memory mobile devices (mobile phones, tablets ...)
Atomic Atomic properties (thread safe, but requires a lot of resources) designed for multithreading, the default is to ensure that only one thread can write at the same time, which is itself a spin lock; write multiple read, single thread write, multiple threads read
Note: When you override the Get and set methods of a property, you need to add it after @implementation: @synthesiae Property Name = _ Property name;
Mutual exclusion lock vs. spin lock
Mutex: If another thread is found to be executing the lock code, the thread goes into hibernation (ready state), and the thread wakes (executes) after the other thread has opened the lock.
Spin lock: If another thread is found to be locking code, the thread will wait until the locked code is executed in a dead loop, and the spin lock is more suitable for executing the code;
Note: Almost all classes provided by Uikit are thread insecure, and all UI update operations are performed on the main thread
Atomic and non-atomic properties, mutex and spin lock introduction