アクセサを使って値をインクリメントしています。これ、ぱっと見て問題があると感じますか? このコードはマルチスレッド環境で動くため、プロパティは以下のようにデフォルトのatomicで(nonatomicを指定せず)定義されています。 @interface AtomicTest : NSObject { int count; } @property(assign) int count; - (void)increment; @end @implementation AtomicTest @synthesize count; - (void)increment { self.count++; } @end int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; A
![『Objective-Cでatomicな宣言プロパティがatomicであるとは限らない話』](https://cdn-ak-scissors.b.st-hatena.com/image/square/cc0247d2b1a29a71b2a67aca8aa4b2f32269ac02/height=288;version=1;width=512/https%3A%2F%2Fstat.profile.ameba.jp%2Fprofile_images%2F20140603%2F00%2Ff4%2Fzm%2Fj%2Fo032003201401721935051.jpg)