Add MutexLocker to ConnectedComponents::GetComponent and SparsePoseGr… (#565)

…aph::TrimmingHandle::MarkSubmapAsTrimmed

To make them compile successfully in google.
master
jie 2017-11-10 08:21:20 -08:00 committed by Wally B. Feed
parent 752a279035
commit ed71914805
3 changed files with 5 additions and 2 deletions

View File

@ -92,6 +92,7 @@ std::vector<std::vector<int>> ConnectedComponents::Components() {
} }
std::vector<int> ConnectedComponents::GetComponent(const int trajectory_id) { std::vector<int> ConnectedComponents::GetComponent(const int trajectory_id) {
common::MutexLocker locker(&lock_);
const int set_id = FindSet(trajectory_id); const int set_id = FindSet(trajectory_id);
std::vector<int> trajectory_ids; std::vector<int> trajectory_ids;
for (const auto& entry : forest_) { for (const auto& entry : forest_) {

View File

@ -247,7 +247,8 @@ class SparsePoseGraph : public mapping::SparsePoseGraph {
~TrimmingHandle() override {} ~TrimmingHandle() override {}
int num_submaps(int trajectory_id) const override; int num_submaps(int trajectory_id) const override;
void MarkSubmapAsTrimmed(const mapping::SubmapId& submap_id) override; void MarkSubmapAsTrimmed(const mapping::SubmapId& submap_id)
REQUIRES(parent_->mutex_) override;
private: private:
SparsePoseGraph* const parent_; SparsePoseGraph* const parent_;

View File

@ -251,7 +251,8 @@ class SparsePoseGraph : public mapping::SparsePoseGraph {
~TrimmingHandle() override {} ~TrimmingHandle() override {}
int num_submaps(int trajectory_id) const override; int num_submaps(int trajectory_id) const override;
void MarkSubmapAsTrimmed(const mapping::SubmapId& submap_id) override; void MarkSubmapAsTrimmed(const mapping::SubmapId& submap_id)
REQUIRES(parent_->mutex_) override;
private: private:
SparsePoseGraph* const parent_; SparsePoseGraph* const parent_;