VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-how-to-check-current-state-of-a-thread/

⇱ C# | How to check current state of a thread - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# | How to check current state of a thread

Last Updated : 11 Jul, 2025
A Thread class is responsible for creating and managing a thread in multi-thread programming. It provides a property known as ThreadState to check the current state of the thread. The initial state of a thread is Unstarted state. Syntax:
public ThreadState ThreadState{ get; }
Return Value: This property returns the value that indicates the state of the current thread. Below programs illustrate the use of ThreadState property: Example 1: Output:
The name of the current state of the main thread is: Running
Example 2:
Output:
ThreadState of TR1 thread is: Unstarted
ThreadState of TR2 thread is: Unstarted
ThreadState of TR1 thread is: Running
ThreadState of TR2 thread is: WaitSleepJoin
Reference:
Comment

Explore