在 win32 中如何获取线程的当前状态(例如阻塞、挂起、运行等..)?

发布于 2024-07-09 08:28:18 字数 337 浏览 5 评论 0原文

我找不到生成此信息的记录 API。

一位朋友建议我使用 NtQuerySystemInformation。 查找后,信息就在那里(请参阅 SYSTEM_THREAD )但它没有记录,而且不是很优雅 - 我获取系统中所有线程的信息。

您是否知道有更优雅、最好有文档记录的 API 来执行此操作?

I couldn't find a documented API that yields this information.

A friend suggested I use NtQuerySystemInformation. After looking it up, the information is there (see SYSTEM_THREAD ) but it is undocumented, and not very elegant - I get the information for all threads in the system.

Do you know of a more elegant, preferably documented API to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

只有影子陪我不离不弃 2024-07-16 08:28:18

除了使用 NtQuerySystemInformation 之外,没有其他方法。
然而,它可能不那么复杂,这是事实,但微软缺乏实现。

我在这里发布了一个使用起来非常优雅的工作类:

如何获取线程状态(例如挂起)、内存+CPU使用率、启动时间、优先级等

There is no other way than using NtQuerySystemInformation.
However it could be less complicated, that's true, but Microsoft lacks an implementation.

I posted a working class here that is very elegant to use:

How to get thread state (e.g. suspended), memory + CPU usage, start time, priority, etc

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