为什么if (dispatch_get_current_queue() == socketQueue)
需要代码?为什么不能dispatch_sync(socketQueue, block)
直接使用???
提前致谢!
- (BOOL)isConnected
{
__block BOOL result = NO;
dispatch_block_t block = ^{
result = (flags & kConnected) ? YES : NO;
};
if (dispatch_get_current_queue() == socketQueue)
block();
else
dispatch_sync(socketQueue, block);
return result;
}
顺便说一句,代码来自XMPPFramework