merlimat commented on issue #6277: [Issue 4070][pulsar-client-cpp] Fix for 
possible deadlock when closing Pulsar client
URL: https://github.com/apache/pulsar/pull/6277#issuecomment-585336709
 
 
   @heronr I'm not sure that fixes the underlying issue. It still will be 
triggering (another) std::thread object being destroyed from itself.
   
   Actually, I think the solution should be easy: just use 
`std::sthread::detach()` 
(http://www.cplusplus.com/reference/thread/thread/detach/) on top of your 
original commit: 
   
   ```cpp
   if (std::this_thread::get_id() != worker_.get_id() && worker_.joinable()) {
       worker_.join();
   } else {
       worker_.detach();
   }
   ```

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


With regards,
Apache Git Services

Reply via email to