线程状态

NEW(A thread that has not yet started is in this state.)
尚未启动的线程处于此状态。 Thread t = new Thread ();

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();

WAITING (A thread that is waiting indefinitely for another thread to perform a particular action is in this state.)
正在等待另一个线程执行特定动作的线程处于此状态。 Object.wait Thread.join LockSupport.park

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.)
已退出的线程处于此状态。

posted @ 2019-06-14 18:40  喝花茶  阅读(137)  评论(0编辑  收藏  举报