merlimat commented on a change in pull request #12427:
URL: https://github.com/apache/pulsar/pull/12427#discussion_r732913138



##########
File path: pulsar-client-cpp/lib/ExecutorService.cc
##########
@@ -27,22 +27,30 @@ DECLARE_LOG_OBJECT()
 
 namespace pulsar {
 
-ExecutorService::ExecutorService()
-    : io_service_(new boost::asio::io_service()),
-      work_(new BackgroundWork(*io_service_)),
-      worker_(std::bind(&ExecutorService::startWorker, this, io_service_)) {}
+ExecutorService::ExecutorService() {}
 
 ExecutorService::~ExecutorService() { close(); }
 
-void ExecutorService::startWorker(std::shared_ptr<boost::asio::io_service> 
io_service) { io_service_->run(); }
+void ExecutorService::start() {
+    auto self = shared_from_this();
+    std::thread t{[self] {
+        if (self->isClosed()) {
+            return;
+        }
+        boost::system::error_code ec;
+        self->getIOService().run(ec);

Review comment:
       When we stop the IOService, will the `run()` terminate even if the 
`work_` item is still there?




-- 
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]


Reply via email to