According to the documentation, :
Because the Running state has a value of 0, it is not possible to perform a bit test to discover this state. Instead, the following test (in pseudo-code) can be used:
if ((state & (Unstarted | Stopped)) == 0) // implies RunningThreads are often in more than one state at any given time.
and api
The Thread.ThreadState property of a thread provides the current state of a thread. Applications must use a bitmask to determine whether a thread is running. Since the value for
Runningis zero (0), test whether a thread is running by using C# code such as(myThread.ThreadState & (ThreadState.Stopped | ThreadState.Unstarted)) == 0or Visual Basic code such as(myThread.ThreadState And (ThreadState.Stopped Or ThreadState.Unstarted)) = 0.
Searching through SO (1,2,3) I only find why ThreadState should not be used for flow control since the state checked could immediately change. For cases when you check it for debugging why would you use the bitmask above as opposed to just myThread.ThreadState==0?