########################################
发布于 2022-03-03 11:40:44
- (void)GCD{
int x=0,y=0
[super viewDidLoad]
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSLog(@"%d",x++)
dispatch_sync(dispatch_get_main_queue(), ^{
NSLog(@"%d",++y)
})
NSLog(@"%d",y++)
})
NSLog(@"%d",x+y)
while (1) {}
}
上述程序输出是()
int x=0,y=0
[super viewDidLoad]
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSLog(@"%d",x++)
dispatch_sync(dispatch_get_main_queue(), ^{
NSLog(@"%d",++y)
})
NSLog(@"%d",y++)
})
NSLog(@"%d",x+y)
while (1) {}
}
上述程序输出是()
登录后免费查看答案
关注者
0
被浏览
4