shibd commented on code in PR #17395:
URL: https://github.com/apache/pulsar/pull/17395#discussion_r962406592
##########
pulsar-client-cpp/lib/PeriodicTask.cc:
##########
@@ -27,9 +27,14 @@ void PeriodicTask::start() {
}
state_ = Ready;
if (periodMs_ >= 0) {
- auto self = shared_from_this();
+ std::weak_ptr<PeriodicTask> weakSelf{shared_from_this()};
timer_.expires_from_now(boost::posix_time::millisec(periodMs_));
- timer_.async_wait([this, self](const ErrorCode& ec) {
handleTimeout(ec); });
+ timer_.async_wait([weakSelf](const ErrorCode& ec) {
Review Comment:
Just want to discuss whether there is a way to use unit tests to cover the
cyclic references that are not allowed.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]