public class Test{
private static class UseThread extends Thread {
public UseThread(String name) {
super(name);
}
@Override
public void run() {
//如果现在这个while的条件不是“!isInterrupted()”而是“true”,那么即使main方法里调用了test.interrupt()还是无法终止线程的,这就是java协作式。
while (!isInterrupted(
多线程中止线程的方法
最新推荐文章于 2022-08-24 08:56:04 发布