Skip to content

Commit

Permalink
8325754: Dead AbstractQueuedSynchronizer$ConditionNodes survive minor…
Browse files Browse the repository at this point in the history
… garbage collections

Backport-of: 60cbf2925024b1c2253256688ae41741fff0a860
  • Loading branch information
Neethu Prasad authored and Paul Hohensee committed Jul 11, 2024
1 parent cfe714b commit 4c58e1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1080,13 +1080,18 @@ public ConditionObject() { }
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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1448,13 +1448,18 @@ public ConditionObject() { }
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;
}
}
Expand Down

1 comment on commit 4c58e1b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.