rekire
rekire

Reputation: 47945

How can I get the state of a program?

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.

Upvotes: 6

Views: 823

Answers (2)

rkosegi
rkosegi

Reputation: 14638

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++

Upvotes: 2

Alex K.
Alex K.

Reputation: 175766

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)

Upvotes: 2

Related Questions