help wanted
Repository metrics
- Stars
- (1,134 stars)
- PR merge metrics
- (PR metrics pending)
Description
目前main()里 在不停的进行点击,识图操作。 在【停止脚本】按钮加了 thread.interrupt();希望通过捕捉异常的方式停止脚本。 把脚本放在try里面。try{脚本} catch ( InterruptedException e ) {} 但基本停不下来。 我现在是在识图的方法里加了判断,然后exit。但这样直接把整个程序弄崩了。。 if(Thread.currentThread().isInterrupted()){ System.exit( 0 ); }
大佬,有没有什么好点的办法?网上查了资料,好像java里就是不太好停止一个正在运行的程序。只能一步步判断正常结束线程吗?