diff --git a/Gazebo_exercise/gazebo7_7.14.0_exercise/gazebo/physics/World.cc b/Gazebo_exercise/gazebo7_7.14.0_exercise/gazebo/physics/World.cc index 9ea63f9..fd22232 100644 --- a/Gazebo_exercise/gazebo7_7.14.0_exercise/gazebo/physics/World.cc +++ b/Gazebo_exercise/gazebo7_7.14.0_exercise/gazebo/physics/World.cc @@ -175,6 +175,21 @@ World::~World() delete this->dataPtr; this->dataPtr = nullptr; + ////////////////Added by zenglei for Asyn event and processMessages/////////////// + if (this->dataPtr->event_thread) + { + this->dataPtr->event_thread->join(); + delete this->dataPtr->event_thread; + this->dataPtr->event_thread = nullptr; + } + + if(this->dataPtr->async_processmessages_thread) + { + this->dataPtr->async_processmessages_thread->join(); + delete this->dataPtr->async_processmessages_thread; + this->dataPtr->async_processmessages_thread = nullptr; + } + ////////////////////////////////////////////////////////////////////////////////// } ////////////////////////////////////////////////// @@ -1352,6 +1367,24 @@ void World::Fini() delete this->dataPtr->thread; this->dataPtr->thread = nullptr; } + + /////////////////Added for asyn event by zenglei///////////////////// + + if (this->dataPtr->event_thread) + { + this->dataPtr->event_thread->join(); + delete this->dataPtr->event_thread; + this->dataPtr->event_thread = nullptr; + } + + if(this->dataPtr->async_processmessages_thread) + { + this->dataPtr->async_processmessages_thread->join(); + delete this->dataPtr->async_processmessages_thread; + this->dataPtr->async_processmessages_thread = nullptr; + } + + ////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////