Which is the proper way of using @synchronized?
ios, memory-management, nsarray, nsmutablearray, objective-c
Solution
As you've phrased the question, both statements are equivalent as a matter of concurrency safety strategy.
Depending on the scale and how far you have completed work on your project, you may wish to consider an alternative strategy for thread-safety altogether.
Recently, Apple has made a point of recommending thread-safety-by-serialization rather than traditional blocking. In short, as contention increases, serialized access is far more efficient than blocking with @synchronize.
Rather than synchronize, consider setting up a GCD serial queue and queuing up access to resources shared across threads.
Problem
``` @property (atomic, retain) NSArray *array; ``` I don't override a setter and a getter of the array. I could use @synchronized(array){} or @synchronized(self.array){}. As I knows all cases are correct, am I right?