转换图片路径为相对路径

This commit is contained in:
罗祥
2019-11-14 17:45:58 +08:00
parent e266780b49
commit 2ffc0a3a94
29 changed files with 342 additions and 89 deletions

View File

@ -0,0 +1,17 @@
package com.heibaiying.interrupt;
/**
* interrupt() 只是设置中断标志位,并不能中断线程
*/
public class J1_Interrupt {
public static void main(String[] args) throws InterruptedException {
Thread thread = new Thread(() -> {
while (true) {
System.out.println("子线程打印");
}
});
thread.start();
Thread.sleep(10);
thread.interrupt();
}
}

View File

@ -0,0 +1,18 @@
package com.heibaiying.interrupt;
/**
* isInterrupted() 用于检查当前线程是否存在中断标志位
*/
public class J2_IsInterrupted {
public static void main(String[] args) throws InterruptedException {
Thread thread = new Thread(() -> {
while (!Thread.currentThread().isInterrupted()) {
System.out.println("子线程打印");
}
});
thread.start();
Thread.sleep(10);
thread.interrupt();
}
}

View File

@ -0,0 +1,18 @@
package com.heibaiying.interrupt;
/**
* 判断当前线程的中断状态,并清除当前线程的中断标志位
*/
public class J3_Interrupted {
public static void main(String[] args) throws InterruptedException {
Thread thread = new Thread(() -> {
while (!Thread.interrupted() || !Thread.currentThread().isInterrupted()) {
System.out.println("子线程打印");
}
});
thread.start();
Thread.sleep(10);
thread.interrupt();
}
}