Is there a queue dictionary for the GCD queue

I really love the threadDictionary property in NSThread : it’s very convenient to store things using threadDictionary rights.

Is there an equivalent dictionary for the GCD queue?

+4
source share
2 answers

You might want to explore dispatch_set_context/dispatch_get_context . The documentation here and here . You have to manage the context, but it may be what you are looking for.

+3
source

If you can target iOS 5 and above, you can use dispatch_queue_get[set]_specific() , which allows you to add dictionary values ​​(like a key) to the queue. I can’t find the document pages on them, oddly enough, but they are commented out in queue.h

+3
source

Source: https://habr.com/ru/post/1246486/


All Articles