#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self gcdDemo];
}
- (void)gcdDemo {
dispatch_queue_t queue = dispatch_queue_create("itcast", DISPATCH_QUEUE_CONCURRENT);
dispatch_async(queue, ^{
dispatch_sync(queue, ^{
NSLog(@"登录..%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"下载文件A %@",[NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"下载文件B %@",[NSThread currentThread]);
});
});
}
@end