dispatch_queue_t queueA = dispatch_queue_create("TestQueue", DISPATCH_QUEUE_SERIAL);
dispatch_queue_t queueB = dispatch_queue_create("TestQueue", DISPATCH_QUEUE_CONCURRENT);
dispatch_sync(dispatch_queue_create("testQueueA", DISPATCH_QUEUE_CONCURRENT), ^{
});
dispatch_async(dispatch_queue_create("testQueueB", DISPATCH_QUEUE_CONCURRENT), ^{
});
dispatch_sync(dispatch_queue_create("testQueueC", DISPATCH_QUEUE_SERIAL), ^{
});
dispatch_async(dispatch_queue_create("", DISPATCH_QUEUE_SERIAL), ^{
});
dispatch_sync(dispatch_get_main_queue(), ^{
});
dispatch_async(dispatch_get_main_queue(), ^{
});
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
});
});
NSArray *array = @[@"A",@"B",@"C",@"D",@"E"];
dispatch_apply(array.count, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t index) {
NSLog(@"%@", [array objectAtIndex:index]);
});
dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
sleep(3);
});
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
sleep(2);
});
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
sleep(1);
});
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
});