I have a long running function inside an asynchronous (serial) worker queue.
I know that sometimes this function hangs inside a particular openCV call.
For some reason this hang is also causing the main thread to hang.
When pausing and entering debug mode I see that there is a call to
semaphore_wait_trap()
on the main thread (Queue)
I can suspend the hanging thread (My worker queue) in debug mode and then this trap goes away and the GUI becomes responsive once again on the phone.
After unpausing the worker thread the GUI is responsive for 1-2 seconds (I suspect until this thread is activated again) and then the UI becomes unresponsive once again.
This thread makes no dispatch_sync()
calls to the main thread/Queue
Is it possible that IOS pauses the main thread ("traps" it) because the worker is long running?
Can I force it to remove the block??
I am adding some print screens of the debug mode stack.
Before suspending the hanging Queue:
And the hanging thread:
And After Pausing and suspending the bad queue:
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…