Suppose I have an @property declared like this:
@property (readwrite,retain) NSObject *someObject;
And I synthesize it like this:
@synthesize someObject = _someObject;
This generates getters/setters for me. Also, according to the docs, the setter will have built in thread safety code.
Now, suppose I want to add some code to the setSomeObject: method. Is there any way that I can extend the existing on from @synthesize? I want to be able to reuse the the thread safety code that it autogenerates.
What
@synthesizedoes is equivalent to:or
so you can use this code and extend the method.
However, as you said, this code might not be thread-safe.
For thread safety, you might want to take a look at
NSLockor@synchronized(thanks to unwesen for pointing this out).