“__workq_kernreturn”是什么意思在 iOS 崩溃日志中或当您暂停应用程序的执行时指示?

发布于 2025-01-02 23:15:53 字数 444 浏览 2 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瑾夏年华 2025-01-09 23:15:53

除非有很多,否则没什么可担心的。如果有很多,这表明您可能生成了比应有的更多的线程,但 workq_kernreturn 本身仍然不是问题。这通常意味着线程正在完成。它的源代码可以在开源中找到。如果您想了解一下它的功能,请访问 apple.com

您可能看到的最常见的堆栈是这个:

_workq_kernreturn
_pthread_wqthread
start_wqthread

由于优化,您看不到对 _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:

_workq_kernreturn
_pthread_wqthread
start_wqthread

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文