简体   繁体   中英

Stop waiting for user input in java

The scenario is like that: One thread is handling with the UI, and the second is handling the logic in the backgorund. Both are working simultaneously.

If some event occurred, and I want that the first thread will stop to wait for user command and will execute other task.

Is it possible to do it?

It depends on your implementation and architecuture, but generally, you can't stop waiting for user input. For instance, calls to System.in are effectively translated to system calls which cannot be cancelled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM