I'm trying to get a .NET thread state.
For this I check the ProcessThread.ThreadState property.
However when I use Thread.Sleep on that thread and check its state with Process Explorer - I see that it's in "Wait: Delay Exectuion", while my ThreadState is still "Running".
How can that be?
C# Thread's state and "Sleep"
1.3k views Asked by Idov At
1
The
Processclass caches properties on first access, so you will probably need to call theRefreshmethod to get an updatedThreadState. It seems that theProcessThreadobjects (from theProcessThreadsproperty) are not attached to the parentProcess, and the values it contains are not updated whenRefreshis called. You will need to go through theProcessobject again.Something like: