diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index c3a6a3de5bc..b45ff1d7afc 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -1700,26 +1700,26 @@ public final void stop() { * if the current thread cannot modify this thread */ public void interrupt() { - if (this != Thread.currentThread()) { + if (Thread.currentThread() != this) { checkAccess(); + } - // thread may be blocked in an I/O operation + interrupted = true; + interrupt0(); // inform VM of interrupt + + // thread may be blocked in an I/O operation + if (Thread.currentThread() != this) { Interruptible blocker; synchronized (interruptLock) { blocker = nioBlocker; if (blocker != null) { - interrupted = true; - interrupt0(); // inform VM of interrupt blocker.interrupt(this); } } if (blocker != null) { blocker.postInterrupt(); - return; } } - interrupted = true; - interrupt0(); // inform VM of interrupt } /**