1 | | This problem may cause crash such as: |
| 1 | There may be some compatibility problems between dispatch queue and PJLIB functions. In particular, according to the [https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/dispatch_queue_create.3.html documentation]): |
| 2 | |
| 3 | {{{ |
| 4 | The following interfaces MUST NOT be called by blocks submitted to a dispatch queue: |
| 5 | • pthread_cancel(): |
| 6 | • pthread_detach() |
| 7 | • pthread_join() |
| 8 | • pthread_kill() |
| 9 | • pthread_exit() |
| 10 | |
| 11 | While the result of pthread_self() may change between invocations of blocks, the value |
| 12 | will not change during the execution of any single block. Because the underlying |
| 13 | thread may change beteween block invocations on a single queue, using per-thread |
| 14 | data as an out-of-band return value is error prone. In other words, the result of |
| 15 | calling pthread_setspecific() and pthread_getspecific() is well defined within |
| 16 | a single block, but not across multiple blocks. |
| 17 | }}} |
| 18 | |
| 19 | In iOS capture device, calling pj_thread_register() (which relies on pthread_get/setspecific()) inside a dispatch queue may cause crash such as: |