__block int x = 5;
dispatch_queue_t abe = dispatch_queue_create([[NSString stringWithFormat:@"abe'sQueue.%@", self] UTF8String], NULL);
dispatch_sync(abe, ^{
NSLog(@"%@", [self returnSomething]);
dispatch_async(dispatch_get_main_queue(), ^{
x = 20;
});
});
NSLog(@"%d", x);
上面的结果总是 5 是 'x' 的记录值,即使主线程的嵌套回调异步更改了值。关于我哪里出错的任何想法?