A Class Property, Such as:
@interface TestModel
@property (nonatomic, copy) NSString *testStr;
@end
At main Thread:
for (model in modellist) {
if ((!model.testStr || ![model.testStr isKindOfClass:[NSString class]] || model.testStr.length == 0)) {
NSLog(@"empty str");
}
NSLog(@"not empty str");
}
At BackGround Thread:
for (model in modellist) {
model.testStr = anotherStringFromAlloc
}
At main thread:Only read property
At backGround thread: Write property content
Is this thread safe?
After read some source code, I have another question is: Dose objc_retain and objc_release same obj is thread safe ?