How can I verify that I am running on a given GCD queue without using dispatch_get_current_queue()?

Assign whatever identifier you want using dispatch_queue_set_specific(). You can then check your identifier using dispatch_get_specific().

Remember that dispatch_get_specific() is nice because it’ll start at the current queue, and then walk up the target queues if the key isn’t set on the current one. This usually doesn’t matter, but can be useful in some cases.

Leave a Comment

tech