The state of a thread can be obtained from the ThreadState property provided by Thread. It is shown here:
public ThreadState ThreadState{ get; }
The state of the thread is returned as a value defined by the ThreadState enumeration. It defines the following values:
ThreadState.Aborted | ThreadState.AbortRequested |
ThreadState.Background | ThreadState.Running |
ThreadState.Stopped | ThreadState.StopRequested |
ThreadState.Suspended | ThreadState.SuspendRequested |
ThreadState.Unstarted | ThreadState.WaitSleepJoin |
All but one of these values is self-explanatory. The one that needs some explanation is ThreadState.WaitSleepJoin. A thread enters this state when it is waiting because of a call to Wait( ), Sleep( ), or Join( ).