更新时间:2022-06-25 23:24:41
我不知道你在哪里读到的执行IO时,线程处于BLOCKED状态。 BLOCKED州文档说:
I don't know where you read that a thread is in the BLOCKED state when doing IO. The BLOCKED state documentation says:
线程状态被阻塞等待监视器锁定。处于阻塞状态的线程正在等待监视器锁定以在调用Object.wait之后输入同步块/方法或重新输入同步块/方法。
Thread state for a thread blocked waiting for a monitor lock. A thread in the blocked state is waiting for a monitor lock to enter a synchronized block/method or reenter a synchronized block/method after calling Object.wait.
所以,不,一个线程在执行IO时不处于阻塞状态(除非当然读取或写入强制它等待对象的监视器。)
So, no, a thread is not in a blocked state while doing IO (unless of course reading or writing forces it to wait on an object's monitor).