Theproperty provides information about the status of a thread. Because threads can be in more than one state at any given time, the value stored in ThreadState can be a combination of the values in the enumeration. For example, if a thread is blocked on a call to , and another thread calls the method on that same thread, the thread is in both the and the state at the same time.
Changing Thread States
Once a thread has started, you can call its methods to change its state. For example, you can cause a thread to pause for a fixed number of milliseconds by calling. The Sleep method takes as a parameter a time-out, which is the number of milliseconds that the thread remains blocked.
Calling Sleep with the argumentcauses a thread to sleep until it is interrupted by another thread that calls . The Interrupt method wakes the destination thread out of any wait state it may be in and causes an exception to be raised.
You can also pause a thread by calling. When a thread calls Suspend on itself, the call blocks until another thread resumes it by calling . When a thread calls Suspend on another thread, the call is non-blocking and causes the other thread to pause. Calling Resume breaks another thread out of its suspended state and causes it to resume execution. Unlike Sleep, Suspend does not immediately stop a thread; the suspended thread does not pause until the common language runtime determines that it has reached a safe point.
The Abort method stops a running thread by raising aexception that causes the thread to die.
Seefor detailed information about these methods.