You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/03/20 01:33:20 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #3863: [cpp client] implement reference count for close()

sijie commented on a change in pull request #3863: [cpp client] implement reference count for close()
URL: https://github.com/apache/pulsar/pull/3863#discussion_r267157994
 
 

 ##########
 File path: pulsar-client-cpp/lib/ConsumerImpl.cc
 ##########
 @@ -110,6 +110,10 @@ Future<Result, ConsumerImplBaseWeakPtr> ConsumerImpl::getConsumerCreatedFuture()
     return consumerCreatedPromise_.getFuture();
 }
 
+void ConsumerImpl::incrRefCount() { ++refCount_; }
+
+bool ConsumerImpl::shouldTearDown() { return refCount_ > 0 ? refCount_-- == 0 : refCount_ == 0; }
 
 Review comment:
   the name here doesn't indicate it is decrementing the `refCount_`. I would suggest calling it something like `safeDecRefCount` and return the value of `refCount_` after decrementing.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services