GCD and foreign thread

你。 提交于 2019-12-23 05:23:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!