Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 544
user500 Avatar asked Mar 02 '11 11:03

user500


2 Answers

How about dispatch_queue_get_label?

like image 126
zoul Avatar answered Nov 18 '22 16:11

zoul


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))!)
like image 33
cromandini Avatar answered Nov 18 '22 14:11

cromandini