本文介绍了Java线程 - 阻止状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个非常基本的问题。如果线程在IO操作中忙,为什么不将其视为RUNNING状态?如果IO操作需要很长时间,则表示该线程正在执行其工作。如果一个线程在实际工作时怎么称为BLOCKED?
I have a very basic question. If a thread is busy in IO operation why it is not considered in a RUNNING state? If the IO operation is taking long time it means that the thread is doing its work. How can a thread be called BLOCKED when it is actually doing it's work?
推荐答案
我不知道你在哪里读到的执行IO时,线程处于BLOCKED状态。 说:
I don't know where you read that a thread is in the BLOCKED state when doing IO. The BLOCKED state documentation says:
所以,不,一个线程在执行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).
这篇关于Java线程 - 阻止状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!