8325754: Dead AbstractQueuedSynchronizer$ConditionNodes survive minor garbage collections

Reviewed-by: alanb
This commit is contained in:
Viktor Klang 2024-02-27 10:38:36 +00:00
parent da14aa463b
commit 60cbf29250
2 changed files with 10 additions and 0 deletions

View File

@ -1127,13 +1127,18 @@ public abstract class AbstractQueuedLongSynchronizer
private void doSignal(ConditionNode first, boolean all) {
while (first != null) {
ConditionNode next = first.nextWaiter;
if ((firstWaiter = next) == null)
lastWaiter = null;
else
first.nextWaiter = null; // GC assistance
if ((first.getAndUnsetStatus(COND) & COND) != 0) {
enqueue(first);
if (!all)
break;
}
first = next;
}
}

View File

@ -1506,13 +1506,18 @@ public abstract class AbstractQueuedSynchronizer
private void doSignal(ConditionNode first, boolean all) {
while (first != null) {
ConditionNode next = first.nextWaiter;
if ((firstWaiter = next) == null)
lastWaiter = null;
else
first.nextWaiter = null; // GC assistance
if ((first.getAndUnsetStatus(COND) & COND) != 0) {
enqueue(first);
if (!all)
break;
}
first = next;
}
}