GCD实现单例

这几天看GCD,居然可以实现单例:

- (id) sharedInstance

{

static MySingleton *SharedInstance = nil;

static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{

SharedInstance = [MySingleton new];

});

return SharedInstance;

原文地址:https://www.cnblogs.com/celestial/p/2584980.html