Github user jeking3 commented on a diff in the pull request: https://github.com/apache/thrift/pull/980#discussion_r59306037 --- Diff: lib/cpp/src/thrift/server/TThreadedServer.h --- @@ -83,12 +88,56 @@ class TThreadedServer : public TServerFramework { virtual void serve(); protected: + /** + * Drain recently connected clients by joining their threads - this is done lazily because + * we cannot do it inside the thread context that is disconnecting. + */ + virtual void drainDeadClients(); + + /** + * Implementation of TServerFramework::onClientConnected + */ virtual void onClientConnected(const boost::shared_ptr<TConnectedClient>& pClient) /* override */; - virtual void onClientDisconnected(TConnectedClient* pClient) /* override */; + + /** + * Implementation of TServerFramework::onClientDisconnected + */ + virtual void onClientDisconnected(TConnectedClient *pClient) /* override */; boost::shared_ptr<apache::thrift::concurrency::ThreadFactory> threadFactory_; - apache::thrift::concurrency::Monitor clientsMonitor_; + + /** + * A helper wrapper used to wrap the client in something we can use to maintain + * the lifetime of the connected client within a detached thread. --- End diff -- You are correct, we can just store the thread instead of this.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---