问题
Is there a way I can create a new (or associate an existing) dispatch queue and tie it to a specific thread?
I have an AudioUnit callback proc running on a thread I do not control and would like, prior to executing the callback proper, check if some given queue has any block for me to process within that AudioUnit thread.
I can probably use OSAmtomicEnqueue and friends, but was wondering whether GCD already offered some kind of "escape" allowing me to tie a specific thread to a specific queue?
回答1:
According to Apple'doc, the answer is no.
GCD provides and manages FIFO queues to which your application can submit tasks in the form of block objects. Blocks submitted to dispatch queues are executed on a pool of threads fully managed by the system. No guarantee is made as to the thread on which a task executes.
来源:https://stackoverflow.com/questions/11393209/gcd-and-foreign-thread