線程狀態

NEW(A thread that has not yet started is in this state.)
還沒有啓動的線程處於此狀態。 Thread t = new Thread ();this

RUNNABLE (A thread executing in the Java virtual machine is in this state.)
在Java虛擬機中執行的線程處於此狀態。 new Thread().start();線程

BLOCKED (A thread that is blocked waiting for a monitor lock is in this state.)
被阻塞等待監視器鎖定的線程處於此狀態。 synchronized(this) -> while (flag)->obj.wait();orm

WAITING (A thread that is waiting indefinitely for another thread to perform a particular action is in this state.)
正在等待另外一個線程執行特定動做的線程處於此狀態。 Object.wait Thread.join LockSupport.parkci

TIMED_WAITING (A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.)
正在等待另外一個線程執行動做達到指定等待時間的線程處於此狀態。 Thread.sleep Object.wait(timeout) Thread.join(timeout) LockSupport.parkNanos LockSupport.parkUntil虛擬機

TERMINATED (A thread that has exited is in this state.)
已退出的線程處於此狀態。 it

相關文章
相關標籤/搜索