const char *a = dispatch_queue_get_label(dispatch_get_main_queue());主线程对应的标识
const char *b = dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL);当前线程对应的标识,然后通过比较两个字符串,即可得出结果。
const char *a = dispatch_queue_get_label(dispatch_get_main_queue());主线程对应的标识
const char *b = dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL);当前线程对应的标识,然后通过比较两个字符串,即可得出结果。
本文标题:如何判断当前线程是不是主线程
本文链接:https://www.haomeiwen.com/subject/uaoqnqtx.html
网友评论