1
0
mirror of https://gitlab.com/obbart/universal_robots_ros_driver.git synced 2026-04-10 01:50:46 +02:00

Removed potential deadlock

This commit is contained in:
Thomas Timm Andersen
2015-09-08 12:40:35 +02:00
2 changed files with 7 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ private:
public: public:
RobotStateRT(std::condition_variable& msg_cond); RobotStateRT(std::condition_variable& msg_cond);
~RobotStateRT();
double getVersion(); double getVersion();
double getTime(); double getTime();
std::vector<double> getQTarget(); std::vector<double> getQTarget();

View File

@@ -45,6 +45,12 @@ RobotStateRT::RobotStateRT(std::condition_variable& msg_cond) {
pMsg_cond_ = &msg_cond; pMsg_cond_ = &msg_cond;
} }
RobotStateRT::~RobotStateRT() {
/* Make sure nobody is waiting after this thread is destroyed */
new_data_available_ = true;
pMsg_cond_->notify_all();
}
bool RobotStateRT::getNewDataAvailable() { bool RobotStateRT::getNewDataAvailable() {
return new_data_available_; return new_data_available_;
} }