Java thread state transition, WAITING to BLOCKED, or RUNNABLE?

前端 未结 3 880
醉梦人生
醉梦人生 2021-01-30 01:43

There seems to be a discrepancy between SO consensus and nearly every Java thread state diagram on the Internet; specifically, regarding thread state transition from

3条回答
  •  春和景丽
    2021-01-30 02:13

    I am focusing on the problem recently.

    as the Oracle document Thread.State says we can use LockSupport.park() to put the current thread into 'WAITING' or 'TIMED_WAITING' state.

    so when you try the LockSupport.unpark(), the specified thread will return to 'RUNNABLE' from 'WAITING'/'TIMED_WAITING'. (I am not sure whether it will go through the 'BLOCKED' state)

提交回复
热议问题