merlimat commented on a change in pull request #10036:
URL: https://github.com/apache/pulsar/pull/10036#discussion_r601647523
##########
File path: pulsar-client-cpp/lib/ConsumerImpl.cc
##########
@@ -752,20 +746,13 @@ Optional<MessageId> ConsumerImpl::clearReceiveQueue() {
}
}
-void ConsumerImpl::increaseAvailablePermits(const ClientConnectionPtr&
currentCnx, int numberOfPermits) {
- int additionalPermits = 0;
+void ConsumerImpl::increaseAvailablePermits(const ClientConnectionPtr&
currentCnx, int delta) {
+ int newAvailablePermits = addAndGet(availablePermits_, delta);
Review comment:
This could also be done directly with:
```suggestion
int newAvailablePermits = availablePermits_.fetch_add(delta,
std::memory_order_relaxed) + delta;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]