zoukankan      html  css  js  c++  java
  • 线程状态

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

  • 相关阅读:
    fastjson报错 java.lang.StackOverflowError
    关于mybatis使用foreach插入速度较慢的问题
    selectKey返回查询的LAST_INSERT_ID的总是1
    使用java制作https证书
    cf 809
    多校 2009 3
    多校 2009 2
    多校 2009 1
    codeforces 808
    hdu 4734 数位DP
  • 原文地址:https://www.cnblogs.com/sleepingDogs/p/11024963.html
Copyright © 2011-2022 走看看