简体   繁体   中英

GCD obtaining queue name/label

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 .

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))!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM