HDFS-9486. Fix valgrind failures when using more than 1 io_service worker thread. Contributed by James Clampffer.

This commit is contained in:
James 2015-12-07 14:54:22 -05:00 committed by James Clampffer
parent 58f2c7183e
commit c59bd00a56
2 changed files with 5 additions and 3 deletions

View File

@ -171,7 +171,6 @@ FileSystemImpl::~FileSystemImpl() {
**/ **/
io_service_->Stop(); io_service_->Stop();
worker_threads_.clear(); worker_threads_.clear();
io_service_.reset(nullptr);
} }
void FileSystemImpl::Connect(const std::string &server, void FileSystemImpl::Connect(const std::string &server,

View File

@ -105,6 +105,11 @@ public:
private: private:
/**
* The IoService must be the first member variable to ensure that it gets
* destroyed last. This allows other members to dequeue things from the
* service in their own destructors.
**/
std::unique_ptr<IoServiceImpl> io_service_; std::unique_ptr<IoServiceImpl> io_service_;
NameNodeOperations nn_; NameNodeOperations nn_;
const std::string client_name_; const std::string client_name_;
@ -120,8 +125,6 @@ private:
std::vector<WorkerPtr> worker_threads_; std::vector<WorkerPtr> worker_threads_;
}; };
} }
#endif #endif