ios 判断是否在主线程
if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0)
{
// do something in main thread
} else {
// do something in other thread
}
if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0)
{
// do something in main thread
} else {
// do something in other thread
}
匿名
你这个只能判断是否是在主队列