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
*/
public void interrupt() {
Thread me = Thread.currentThread();
if (this != me)
if (this != Thread.currentThread()) {
checkAccess();
// set interrupt status
interrupt0();
// thread may be blocked in an I/O operation
if (this != me && blocker != null) {
// 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();
}
/**