dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group, dispatch_get_global_queue(0,0), ^{
// 并行执行的线程一
[self upStudentMessage:self.studentMode];
NSLog(@"11111111 %d",self.IsUpSussecc);
});
dispatch_group_async(group, dispatch_get_global_queue(0,0), ^{
// 并行执行的线程二
[self upStudentPicture:self.studentMode];
NSLog(@"22222222 %d",self.IsUpSussecc);
});
dispatch_group_notify(group, dispatch_get_global_queue(0,0), ^{
// 汇总结果
NSLog(@"3333333 %d",self.IsUpSussecc);
if (self.IsUpSussecc ) {
dispatch_async(self.DB_queue, ^{
NSLog(@"实时上传成功 更新学生状态");
[self updateStudent:self.studentMode StudentState:0]; // 上传成功 更新学生状态
});
}else{
dispatch_async(self.DB_queue, ^{
NSLog(@"实时上传失败 更新学生状态");
[self updateStudent:self.studentMode StudentState:1]; // 上传失败 更新学生状态
});
}
});
网友评论