Home > .NET Framework > Thread States in .NET

Thread States in .NET

What are the various thread states?

The following diagram gives an idea of the various thread states and the transition between them.


Action ThreadState
A thread is created within the common language runtime. Unstarted
A thread calls Start The thread starts running. Running
The thread calls Sleep WaitSleepJoin
The thread calls Wait on another object. WaitSleepJoin
The thread calls Join on another thread. WaitSleepJoin
Another thread calls Interrupt Running
Another thread calls Suspend SuspendRequested
The thread responds to a Suspend request. Suspended
Another thread calls Resume Running
Another thread calls Abort AbortRequested
The thread responds to a Abort request. Stopped
A thread is terminated. Stopped

A note on the background threads:

The frmaework categorizes threads into two flavours background and foreground. This is controlled by the IsBackground property on a thread. When all the Foreground threads in a process terminate the process terminates irrespective of whether background threads are running or not. When atleast one foreground thread is there, the process cannot terminate. When there are no foreground threads even if there are background threads running the process terminates.

Categories: .NET Framework
  1. No comments yet.
  1. November 19, 2010 at 10:59 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: