There's another property of "atomic" that wasn't mentioned which was needed for thread safety before ARC (and probably still is). First explaining why it's needed: Let's say without ARC, you read an object property and immediately retain it. But another thread could come in just between you reading the property and the retain call, set the object property to nil, causing the object to be deallocated. You send retain to a deallocated object, which is unhealthy. And it would be a very rare bug because it only happens when the timing is just right. To prevent this, atomic object properties always return autoreleased objects.
↧