﻿<?xml version="1.0" encoding="utf-8"?><Type Name="ThreadState" FullName="System.Threading.ThreadState" FullNameSP="System_Threading_ThreadState" Maintainer="ecma"><TypeSignature Language="ILASM" Value=".class public sealed serializable ThreadState extends System.Enum" /><TypeSignature Language="C#" Value="public enum ThreadState" /><TypeSignature Language="ILAsm" Value=".class public auto ansi serializable sealed ThreadState extends System.Enum" /><MemberOfLibrary>BCL</MemberOfLibrary><AssemblyInfo><AssemblyName>mscorlib</AssemblyName><AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><Base><BaseTypeName>System.Enum</BaseTypeName></Base><Attributes><Attribute><AttributeName>System.Flags</AttributeName></Attribute><Attribute><AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName></Attribute></Attributes><Docs><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>The <see cref="T:System.Threading.ThreadState" /> enumeration is of interest only in a few debugging scenarios. Your code should never use the thread state to synchronize the activities of threads.</para><para><see cref="T:System.Threading.ThreadState" /> defines a set of all possible execution states for threads. Once a thread is created, it is in at least one of the states until it terminates. Threads created within the common language runtime are initially in the Unstarted state, while external threads that come into the runtime are already in the Running state. An Unstarted thread is transitioned into the Running state by calling <see cref="M:System.Threading.Thread.Start" />. Not all combinations of ThreadState values are valid; for example, a thread cannot be in both the Aborted and Unstarted states.</para><block subset="none" type="note"><para>There are two thread state enumerations, <see cref="T:System.Threading.ThreadState" /> and <see cref="T:System.Diagnostics.ThreadState" />.</para></block><para>The following table shows the actions that cause a change of state.</para><list type="table"><listheader><item><term><para>Action </para></term><description><para>ThreadState </para></description></item></listheader><item><term><para>A thread is created within the common language runtime. </para></term><description><para>Unstarted </para></description></item><item><term><para>Another thread calls the <see cref="M:System.Threading.Thread.Start" /> method on the new thread, and the call returns. </para><para>The <see cref="M:System.Threading.Thread.Start" /> method does not return until the new thread has started running. There is no way to know at what point the new thread will start running, during the call to <see cref="M:System.Threading.Thread.Start" />.</para></term><description><para>Running </para></description></item><item><term><para>The thread calls <see cref="M:System.Threading.Thread.Sleep(System.Int32)" /></para></term><description><para>WaitSleepJoin </para></description></item><item><term><para>The thread calls <see cref="M:System.Threading.Monitor.Wait(System.Object,System.Int32,System.Boolean)" /> on another object. </para></term><description><para>WaitSleepJoin </para></description></item><item><term><para>The thread calls <see cref="M:System.Threading.Thread.Join" /> on another thread. </para></term><description><para>WaitSleepJoin </para></description></item><item><term><para>Another thread calls <see cref="M:System.Threading.Thread.Interrupt" /></para></term><description><para>Running </para></description></item><item><term><para>Another thread calls <see cref="M:System.Threading.Thread.Suspend" /></para></term><description><para>SuspendRequested </para></description></item><item><term><para>The thread responds to a <see cref="M:System.Threading.Thread.Suspend" /> request. </para></term><description><para>Suspended </para></description></item><item><term><para>Another thread calls <see cref="M:System.Threading.Thread.Resume" /></para></term><description><para>Running </para></description></item><item><term><para>Another thread calls <see cref="M:System.Threading.Thread.Abort(System.Object)" /></para></term><description><para>AbortRequested </para></description></item><item><term><para>The thread responds to a <see cref="M:System.Threading.Thread.Abort(System.Object)" /> request. </para></term><description><para>Stopped </para></description></item><item><term><para>A thread is terminated. </para></term><description><para>Stopped </para></description></item></list><para>In addition to the states noted above, there is also the Background state, which indicates whether the thread is running in the background or foreground.</para><para>A thread can be in more than one state at a given time. For example, if a thread is blocked on a call to <see cref="M:System.Threading.Monitor.Wait(System.Object,System.Int32,System.Boolean)" />, and another thread calls <see cref="M:System.Threading.Thread.Abort(System.Object)" /> on the blocked thread, the blocked thread will be in both the WaitSleepJoin and the AbortRequested states at the same time. In this case, as soon as the thread returns from the call to <see cref="M:System.Threading.Monitor.Wait(System.Object,System.Int32,System.Boolean)" /> or is interrupted, it will receive the <see cref="T:System.Threading.ThreadAbortException" /> to begin aborting.</para><para>The <see cref="P:System.Threading.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 Running is zero (0), test whether a thread is running by using C# code such as (myThread.ThreadState &amp; (ThreadState.Stopped | ThreadState.Unstarted)) == 0 or Visual Basic code such as (myThread.ThreadState And (ThreadState.Stopped Or ThreadState.Unstarted)) = 0.</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Specifies the execution states of a <see cref="T:System.Threading.Thread" />.</para></summary></Docs><Members><Member MemberName="Aborted"><MemberSignature Language="ILASM" Value=".field public static literal valuetype System.Threading.ThreadState Aborted = 0x100" /><MemberSignature Language="C#" Value="Aborted" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState Aborted = int32(256)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><Parameters /><MemberValue>Aborted</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The thread state includes <see cref="F:System.Threading.ThreadState.AbortRequested" /> and the thread is now dead, but its state has not yet changed to <see cref="F:System.Threading.ThreadState.Stopped" />.</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName="AbortRequested"><MemberSignature Language="ILASM" Value=".field public static literal valuetype System.Threading.ThreadState AbortRequested = 0x80" /><MemberSignature Language="C#" Value="AbortRequested" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState AbortRequested = int32(128)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><Parameters /><MemberValue>AbortRequested</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The <see cref="M:System.Threading.Thread.Abort(System.Object)" /> method has been invoked on the thread, but the thread has not yet received the pending <see cref="T:System.Threading.ThreadAbortException" /> that will attempt to terminate it.</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName="Background"><MemberSignature Language="ILASM" Value=".field public static literal valuetype System.Threading.ThreadState Background = 0x4" /><MemberSignature Language="C#" Value="Background" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState Background = int32(4)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><Parameters /><MemberValue>Background</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The thread is being executed as a background thread, as opposed to a foreground thread. This state is controlled by setting the <see cref="P:System.Threading.Thread.IsBackground" /> property.</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName="Running"><MemberSignature Language="ILASM" Value=".field public static literal valuetype System.Threading.ThreadState Running = 0x0" /><MemberSignature Language="C#" Value="Running" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState Running = int32(0)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><Parameters /><MemberValue>Running</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The thread has been started, it is not blocked, and there is no pending <see cref="T:System.Threading.ThreadAbortException" />.</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName="Stopped"><MemberSignature Language="ILASM" Value=".field public static literal valuetype System.Threading.ThreadState Stopped = 0x10" /><MemberSignature Language="C#" Value="Stopped" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState Stopped = int32(16)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><Parameters /><MemberValue>Stopped</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The thread has stopped.</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName="StopRequested"><MemberSignature Language="C#" Value="StopRequested" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState StopRequested = int32(1)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><MemberValue>StopRequested</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The thread is being requested to stop. This is for internal use only.</para></summary></Docs></Member><Member MemberName="Suspended"><MemberSignature Language="C#" Value="Suspended" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState Suspended = int32(64)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><MemberValue>Suspended</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The thread has been suspended.</para></summary></Docs></Member><Member MemberName="SuspendRequested"><MemberSignature Language="C#" Value="SuspendRequested" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState SuspendRequested = int32(2)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><MemberValue>SuspendRequested</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The thread is being requested to suspend.</para></summary></Docs></Member><Member MemberName="Unstarted"><MemberSignature Language="ILASM" Value=".field public static literal valuetype System.Threading.ThreadState Unstarted = 0x8" /><MemberSignature Language="C#" Value="Unstarted" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState Unstarted = int32(8)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><Parameters /><MemberValue>Unstarted</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The <see cref="M:System.Threading.Thread.Start" /> method has not been invoked on the thread.</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName="WaitSleepJoin"><MemberSignature Language="ILASM" Value=".field public static literal valuetype System.Threading.ThreadState WaitSleepJoin = 0x20" /><MemberSignature Language="C#" Value="WaitSleepJoin" /><MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Threading.ThreadState WaitSleepJoin = int32(32)" /><MemberType>Field</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Threading.ThreadState</ReturnType></ReturnValue><Parameters /><MemberValue>WaitSleepJoin</MemberValue><Docs><remarks>To be added.</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The thread is blocked. This could be the result of calling <see cref="M:System.Threading.Thread.Sleep(System.Int32)" /> or <see cref="M:System.Threading.Thread.Join" />, of requesting a lock — for example, by calling <see cref="M:System.Threading.Monitor.Enter(System.Object)" /> or <see cref="M:System.Threading.Monitor.Wait(System.Object,System.Int32,System.Boolean)" /> — or of waiting on a thread synchronization object such as <see cref="T:System.Threading.ManualResetEvent" />. </para></summary></Docs><Excluded>0</Excluded></Member></Members><TypeExcluded>0</TypeExcluded></Type>