开发者

GCD obtaining queue name/label

开发者 https://www.devze.com 2023-02-14 20:23 出处:网络
How can I get the current queue name? I mean queue label like com.example.myqueue. In the Xcode 4 debugger I 开发者_开发百科can see just _block_invoke_1.How about dispatch_queue_get_label?In Objecti

How can I get the current queue name?

I mean queue label like com.example.myqueue.

In the Xcode 4 debugger I 开发者_开发百科can see just _block_invoke_1.


How about dispatch_queue_get_label?


In Objective-C you can log the label of the current queue with:

NSLog(@"%s", dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL));

In Swift (2.0):

print(String(UTF8String: dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL))!)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号