利用多线程建立单例

+ (Instance *)shaer{

    static Instance *instance = nil;

    static dispatch_once_t onceToken;

    dispatch_once(&onceToken, ^{

        instance = [[Instance alloc]init];

    });

    return instance;

}

posted @ 2015-09-01 14:16  梦影随风  阅读(87)  评论(0编辑  收藏  举报