xplan ios start
This commit is contained in:
11
xplan-ios/Base/Tool/GCDHelper/GCDHelper.h
Normal file
11
xplan-ios/Base/Tool/GCDHelper/GCDHelper.h
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// GCDHelper.h
|
||||
// YYMobileFramework
|
||||
//
|
||||
// Created by wuwei on 14/7/18.
|
||||
// Copyright (c) 2014年 YY Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
void dispatch_main_sync_safe(dispatch_block_t block);
|
16
xplan-ios/Base/Tool/GCDHelper/GCDHelper.m
Normal file
16
xplan-ios/Base/Tool/GCDHelper/GCDHelper.m
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// GCDHelper.m
|
||||
// YYMobileFramework
|
||||
//
|
||||
// Created by wuwei on 14/7/18.
|
||||
// Copyright (c) 2014年 YY Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GCDHelper.h"
|
||||
void dispatch_main_sync_safe(dispatch_block_t block) {
|
||||
if ([NSThread isMainThread]) {
|
||||
block();
|
||||
}else {
|
||||
dispatch_sync(dispatch_get_main_queue(), block);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user