8198841: Thread.interrupt should set interrupt status while holding blockerLock

Reviewed-by: bpb
This commit is contained in:
Alan Bateman 2018-03-01 18:27:39 +00:00
parent 60ce64e54a
commit 95b1eef0da

View file

@ -1007,22 +1007,22 @@ class Thread implements Runnable {
* @spec JSR-51 * @spec JSR-51
*/ */
public void interrupt() { public void interrupt() {
Thread me = Thread.currentThread(); if (this != Thread.currentThread()) {
if (this != me)
checkAccess(); checkAccess();
// set interrupt status
interrupt0();
// thread may be blocked in an I/O operation // thread may be blocked in an I/O operation
if (this != me && blocker != null) {
synchronized (blockerLock) { synchronized (blockerLock) {
Interruptible b = blocker; Interruptible b = blocker;
if (b != null) { if (b != null) {
interrupt0(); // set interrupt status
b.interrupt(this); b.interrupt(this);
return;
} }
} }
} }
// set interrupt status
interrupt0();
} }
/** /**