I'm observing an program and want to kill it, if it is for some time in the state "wait:executive".

Here is a screenshot of the Process Explorer:

State: wait:executive

How can I get that state by code? Or could maybe tell me somebody what that state exactly mean? This will may help me to find the right query to solve my problem.

有帮助吗?

解决方案

It is not state of program but it's state of thread.One process can have many threads.

You can call WaitForSingleObject to determine some states.

Also you can instantiate WMI using COM and selecting Win32_Thread class.

Here is some example.

More info here : How to determine that a win32 thread is either in Wait or Join or Sleep state in c++

其他提示

It means the thread is waiting for the scheduler/a component of the executive

It can be fetched with WMI Win32_Thread (or .net System.Diagnostics.ProcessThread WaitReason)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top