【发布时间】:2016-09-09 13:12:03
【问题描述】:
我正在学习 GCD。请考虑以下代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
dispatch_sync(dispatch_get_main_queue(), ^{
NSLog(@"Hello world");
});
/* Another implementation */
return YES;
}
我知道,会出现僵局。但是有人可以解释为什么吗?在它(应用程序)“冻结”之前,应用程序将执行哪些具体步骤?
【问题讨论】:
-
你为什么断言会有死锁?
-
@trojanfoe 因为应用程序将冻结。请尝试一下。
-
@DhawalSodhaParmar 它并不迅速
-
这不取决于调用代码的队列吗?
-
这里已经回答了这个问题stackoverflow.com/questions/12379059/…>
标签: ios