diff --git a/tests/isolated/InterruptTest.java b/tests/isolated/InterruptTest.java new file mode 100644 index 00000000..aff2d4fe --- /dev/null +++ b/tests/isolated/InterruptTest.java @@ -0,0 +1,37 @@ +public class InterruptTest { + public static void main(String args[]) { + Thread current = Thread.currentThread(); + System.out.println(current.isInterrupted()); + current.interrupt(); + System.out.println(current.isInterrupted()); + System.out.println(current.isInterrupted()); + System.out.println(Thread.interrupted()); + System.out.println(current.isInterrupted()); + current.interrupt(); + synchronized (current) { + try { + current.wait(1); + System.out.println("no"); + } catch (InterruptedException e) { + System.out.println(e.getClass()); + } + } + synchronized (current) { + try { + current.wait(1); + System.out.println("yes"); + } catch (InterruptedException e) { + System.out.println(e.getClass()); + } + } + current.interrupt(); + synchronized (current) { + try { + current.join(); + System.out.println("yes"); + } catch (InterruptedException e) { + System.out.println(e.getClass()); + } + } + } +}