简体   繁体   中英

How do I get the current state of a thread (e.g. blocking, suspended, running, etc..) in win32?

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?

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 (eg suspended), memory + CPU usage, start time, priority, etc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM