8336384: AbstractQueuedSynchronizer.acquire should cancel acquire when failing due to a LinkageError or other errors
Reviewed-by: alanb
This commit is contained in:
parent
ba69ed7c58
commit
fbe4cc96e2
@ -369,14 +369,19 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
} else if (node.status == 0) {
|
||||
node.status = WAITING; // enable signal and recheck
|
||||
} else {
|
||||
long nanos;
|
||||
spins = postSpins = (byte)((postSpins << 1) | 1);
|
||||
if (!timed)
|
||||
LockSupport.park(this);
|
||||
else if ((nanos = time - System.nanoTime()) > 0L)
|
||||
LockSupport.parkNanos(this, nanos);
|
||||
else
|
||||
break;
|
||||
try {
|
||||
long nanos;
|
||||
if (!timed)
|
||||
LockSupport.park(this);
|
||||
else if ((nanos = time - System.nanoTime()) > 0L)
|
||||
LockSupport.parkNanos(this, nanos);
|
||||
else
|
||||
break;
|
||||
} catch (Error | RuntimeException ex) {
|
||||
cancelAcquire(node, interrupted, interruptible); // cancel & rethrow
|
||||
throw ex;
|
||||
}
|
||||
node.clearStatus();
|
||||
if ((interrupted |= Thread.interrupted()) && interruptible)
|
||||
break;
|
||||
|
@ -748,14 +748,19 @@ public abstract class AbstractQueuedSynchronizer
|
||||
} else if (node.status == 0) {
|
||||
node.status = WAITING; // enable signal and recheck
|
||||
} else {
|
||||
long nanos;
|
||||
spins = postSpins = (byte)((postSpins << 1) | 1);
|
||||
if (!timed)
|
||||
LockSupport.park(this);
|
||||
else if ((nanos = time - System.nanoTime()) > 0L)
|
||||
LockSupport.parkNanos(this, nanos);
|
||||
else
|
||||
break;
|
||||
try {
|
||||
long nanos;
|
||||
if (!timed)
|
||||
LockSupport.park(this);
|
||||
else if ((nanos = time - System.nanoTime()) > 0L)
|
||||
LockSupport.parkNanos(this, nanos);
|
||||
else
|
||||
break;
|
||||
} catch (Error | RuntimeException ex) {
|
||||
cancelAcquire(node, interrupted, interruptible); // cancel & rethrow
|
||||
throw ex;
|
||||
}
|
||||
node.clearStatus();
|
||||
if ((interrupted |= Thread.interrupted()) && interruptible)
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user