ThreadState 列舉

定義

指定執行緒的目前執行狀態。Specifies the current execution state of the thread.

public enum class ThreadState
public enum ThreadState
type ThreadState = 
Public Enum ThreadState
繼承
ThreadState

欄位

Initialized 0

指示執行緒已經初始化,但尚未啟動的狀態。A state that indicates the thread has been initialized, but has not yet started.

Ready 1

該狀態指示沒有可用的處理器,所以執行緒正在等待以使用處理器。A state that indicates the thread is waiting to use a processor because no processor is free. 執行緒準備在下一個可用的處理器上執行。The thread is prepared to run on the next available processor.

Running 2

該狀態指示執行緒目前正在使用處理器。A state that indicates the thread is currently using a processor.

Standby 3

該狀態指示執行緒正要使用處理器。A state that indicates the thread is about to use a processor. 一次只能有一個執行緒可以處於這個狀態。Only one thread can be in this state at a time.

Terminated 4

該狀態指示執行緒已經執行完成並離開。A state that indicates the thread has finished executing and has exited.

Transition 6

該狀態指示執行緒在可以執行之前正在等待資源,而不是等待處理器。A state that indicates the thread is waiting for a resource, other than the processor, before it can execute. 例如,它可能正在等待其執行堆疊從磁碟分頁進來。For example, it might be waiting for its execution stack to be paged in from disk.

Unknown 7

執行緒的狀態不明。The state of the thread is unknown.

Wait 5

該狀態指示執行緒尚未準備使用處理器,因為它正在等待要完成的週邊作業或可以使用的資源。A state that indicates the thread is not ready to use the processor because it is waiting for a peripheral operation to complete or a resource to become free. 執行緒會在備妥時重新排程。When the thread is ready, it will be rescheduled.

備註

重要

有兩個執行緒狀態列舉,System.Diagnostics.ThreadStateSystem.Threading.ThreadStateThere are two thread state enumerations, System.Diagnostics.ThreadState and System.Threading.ThreadState. 執行緒狀態列舉只在幾個調試情況下才有意義。The thread state enumerations are only of interest in a few debugging scenarios. 您的程式碼絕對不應該使用執行緒狀態來同步處理執行緒活動。Your code should never use thread state to synchronize the activities of threads.

適用於

另請參閱