Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,当我们谈论 java 中的中断时,它可能仅在它被调用或操作系统发送的潜在中断Thread.sleep(1000);时才抛出异常?t.interrupt()
Thread.sleep(1000);
t.interrupt()
来自Java 7 语言规范:
调用 时会发生中断操作Thread.interrupt,以及定义为依次调用它的方法,例如ThreadGroup.interrupt.
Thread.interrupt
ThreadGroup.interrupt
没有提到能够中断线程的外部因素。