# HG changeset patch # User alanb # Date 1519928859 0 # Node ID b9ee7c274ee04d5451e912630162c5e04b9776cd # Parent 8d30b49608286722b025b9df1d0493f5f80e79d6 8198841: Thread.interrupt should set interrupt status while holding blockerLock Reviewed-by: bpb diff -r 8d30b4960828 -r b9ee7c274ee0 src/java.base/share/classes/java/lang/Thread.java --- a/src/java.base/share/classes/java/lang/Thread.java Thu Mar 01 10:03:31 2018 -0800 +++ b/src/java.base/share/classes/java/lang/Thread.java Thu Mar 01 18:27:39 2018 +0000 @@ -1007,22 +1007,22 @@ * @spec JSR-51 */ public void interrupt() { - Thread me = Thread.currentThread(); - if (this != me) + if (this != Thread.currentThread()) { checkAccess(); + // thread may be blocked in an I/O operation + synchronized (blockerLock) { + Interruptible b = blocker; + if (b != null) { + interrupt0(); // set interrupt status + b.interrupt(this); + return; + } + } + } + // set interrupt status interrupt0(); - - // thread may be blocked in an I/O operation - if (this != me && blocker != null) { - synchronized (blockerLock) { - Interruptible b = blocker; - if (b != null) { - b.interrupt(this); - } - } - } } /**