I have read something in some foreign code and I want to check my assumption:
@synchronized(self) is used to get rid of the self prefix when setting a property.
So in my example below, I’m setting the strText of the instance, not just a local variable, right?
- (void)myfunction{
NSString * strText = @"var in function";
@synchronized(self)
{
strText = @"var class (self.strText)";
}
}
Please read this Documentation
As Massimo Cafaro pointed out:
“It’s safest to create all the mutual exclusion objects before the application becomes multithreaded, to avoid race conditions.”