Skip to content

Commit

Permalink
refactor: avoid a compare&swap on unbounded requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jponge committed Jan 22, 2024
1 parent b8da91f commit 4811b4b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ public void onItem(I item) {

private void innerOnItem(O item) {
if (state != State.DONE) {
DEMAND_UPDATER.decrementAndGet(this);
if (demand < Long.MAX_VALUE) {
DEMAND_UPDATER.decrementAndGet(this);
}
downstream.onItem(item);
}
}
Expand Down

0 comments on commit 4811b4b

Please sign in to comment.