In a method like this, which do synchronize (i.e. self
or thing
)?
- (BOOL)deleteThing:(MSThing *)thing error:(NSError **)error
{
@synchronized(self) {
if (!thing) {
return YES;
}
NSString *fileName = [[self thingDirectory] stringByAppendingPathComponent:thing.cacheInstanceName];
if (![[NSFileManager defaultManager] fileExistsAtPath:fileName]) {
//...
=== OR ===
- (BOOL)deleteThing:(MSThing *)thing error:(NSError **)error
{
@synchronized(thing) {
if (!thing) {
return YES;
}
NSString *fileName = [[self thingDirectory] stringByAppendingPathComponent:thing.cacheInstanceName];
if (![[NSFileManager defaultManager] fileExistsAtPath:fileName]) {
//...