Skip to content

Commit

Permalink
set the previous head to null in CQueue
Browse files Browse the repository at this point in the history
Signed-off-by: Keshava Munegowda <[email protected]>
  • Loading branch information
kmgowda committed May 24, 2024
1 parent 9f928ce commit 8358ff3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion perl/src/main/java/io/perl/api/impl/CQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public T poll() {
if (cur == null) {
return null;
}
HEAD.set(this, cur);
Object oldHead = HEAD.getAndSet(this, cur);
oldHead = null; //might help the Java garbage collector
return (T) ITEM.getAndSetRelease(cur, null);
}

Expand Down

0 comments on commit 8358ff3

Please sign in to comment.