George Burdell
George Burdell

Reputation: 1359

dispatch_queue_create multiple invocations with same label

I have a requirement to execute a small set of related tasks on a custom thread created for them. The tasks will be scheduled from different classes. I'm planning to use GCD's dispatch_queue_create to create the custom thread and schedule the task on it. Note that all the related tasks must execute only on that one thread in order.
So my question is if I call dispatch_queue_create("my_custom_thread_label", NULL) with the same label from many classes in my codebase, would it all eventually map to just one thread? Or do I need to create it in one place and get a reference to it whenever needed? Thanks.

Upvotes: 11

Views: 2649

Answers (1)

jsd
jsd

Reputation: 7703

You need to create it in one place and pass the pointer around.

Upvotes: 9

Related Questions