Synchronize correctly in FinishTrajectory(). (#980)
PoseGraph{2D,3D}::FinishTrajectory() calls AddWorkItem() which requires the mutex to be held. This adds code to do this.master
parent
525f7afe7e
commit
c09b643d8d
|
@ -392,6 +392,7 @@ void PoseGraph2D::WaitForAllComputations() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PoseGraph2D::FinishTrajectory(const int trajectory_id) {
|
void PoseGraph2D::FinishTrajectory(const int trajectory_id) {
|
||||||
|
common::MutexLocker locker(&mutex_);
|
||||||
AddWorkItem([this, trajectory_id]() REQUIRES(mutex_) {
|
AddWorkItem([this, trajectory_id]() REQUIRES(mutex_) {
|
||||||
CHECK_EQ(finished_trajectories_.count(trajectory_id), 0);
|
CHECK_EQ(finished_trajectories_.count(trajectory_id), 0);
|
||||||
finished_trajectories_.insert(trajectory_id);
|
finished_trajectories_.insert(trajectory_id);
|
||||||
|
|
|
@ -410,6 +410,7 @@ void PoseGraph3D::WaitForAllComputations() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PoseGraph3D::FinishTrajectory(const int trajectory_id) {
|
void PoseGraph3D::FinishTrajectory(const int trajectory_id) {
|
||||||
|
common::MutexLocker locker(&mutex_);
|
||||||
AddWorkItem([this, trajectory_id]() REQUIRES(mutex_) {
|
AddWorkItem([this, trajectory_id]() REQUIRES(mutex_) {
|
||||||
CHECK_EQ(finished_trajectories_.count(trajectory_id), 0);
|
CHECK_EQ(finished_trajectories_.count(trajectory_id), 0);
|
||||||
finished_trajectories_.insert(trajectory_id);
|
finished_trajectories_.insert(trajectory_id);
|
||||||
|
|
Loading…
Reference in New Issue