“__workq_kernreturn”是什么意思在 iOS 崩溃日志中或当您暂停应用程序的执行时指示?
在 iOS 上调试时,如果我暂停执行,我经常会看到多个对“__workq_kernreturn”的引用。
如果我的应用程序发生崩溃,我经常会看到多个线程,如下所示:
Thread 19:
0 libsystem_kernel.dylib 0x332d0cd4 __workq_kernreturn + 8
Thread 20:
0 libsystem_kernel.dylib 0x332d0cd4 __workq_kernreturn + 8
Thread 21:
0 libsystem_kernel.dylib 0x332d0cd4 __workq_kernreturn + 8
“__workq_kernreturn”是否表示正在等待退出的线程,或者是死锁的线程?这是值得担心的事情吗?
When debugging on iOS, if I pause execution I often see multiple references to "__workq_kernreturn".
If my app happens to crash, I often see multiple threads identified as below:
Thread 19:
0 libsystem_kernel.dylib 0x332d0cd4 __workq_kernreturn + 8
Thread 20:
0 libsystem_kernel.dylib 0x332d0cd4 __workq_kernreturn + 8
Thread 21:
0 libsystem_kernel.dylib 0x332d0cd4 __workq_kernreturn + 8
Does "__workq_kernreturn" indicate a thread that is waiting to exit, or a thread that is deadlocked? Is this something to be worried about?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非有很多,否则没什么可担心的。如果有很多,这表明您可能生成了比应有的更多的线程,但
workq_kernreturn
本身仍然不是问题。这通常意味着线程正在完成。它的源代码可以在开源中找到。如果您想了解一下它的功能,请访问 apple.com。您可能看到的最常见的堆栈是这个:
由于优化,您看不到对 _pthread_workq_return() 在那里,但这就是实际发生的情况。
_workq_kernreturn
只是等待自旋锁完成,以便它可以运行队列中的下一个任务(或退出)。It's nothing to worry about unless there are lots of them. If there are lots, that suggests you may be spawning more threads than you probably should, but the
workq_kernreturn
is still not a problem itself. It usually means that the thread is finishing. The source for it is available at opensource.apple.com if you want to take a look at what it does.The most common stack you're probably looking at is this one:
Because of optimizations, you don't see the call to _pthread_workq_return() in there, but that's what's actually happening.
_workq_kernreturn
is just waiting for for the spinlock to finish so it can run the next thing on its queue (or exit).