2
Apple은 ARC에서 싱글 톤 패턴을 구현하기 위해 dispatch_once를 사용하도록 권장하는 이유는 무엇입니까?
ARC에서 싱글 톤의 공유 인스턴스 접근 자에 dispatch_once를 사용하는 정확한 이유는 무엇입니까? + (MyClass *)sharedInstance { // Static local predicate must be initialized to 0 static MyClass *sharedInstance = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ sharedInstance = [[MyClass alloc] init]; // Do any other initialisation stuff here }); …