开发者

If a thread is waiting on a console.readline is the thread suspended?

开发者 https://www.devze.com 2022-12-28 13:35 出处:网络
If a thread is waiting on a co开发者_如何学JAVAnsole.readline is the thread suspended. If not what is it\'s state?The thread is not suspended. It\'s blocked on a method call.There\'s not a good way to

If a thread is waiting on a co开发者_如何学JAVAnsole.readline is the thread suspended. If not what is it's state?


The thread is not suspended. It's blocked on a method call.


There's not a good way to interact (i.e. wait for user input) with the console on a thread if the user doesn't ever enter information. This question (and my answer) came up with a way to terminate the input thread by having the readline in a separate process altogether.

0

精彩评论

暂无评论...
验证码 换一张
取 消