Skip to content
Snippets Groups Projects
Commit cb10f3af authored by Francois Keith's avatar Francois Keith
Browse files

Correct signal destruction in rosPublish.

The trigger signal cannot be destroyed.
parent 543f454a
No related branches found
No related tags found
No related merge requests found
...@@ -206,10 +206,16 @@ namespace dynamicgraph ...@@ -206,10 +206,16 @@ namespace dynamicgraph
if(bindedSignal_.find(signal) == bindedSignal_.end()) if(bindedSignal_.find(signal) == bindedSignal_.end())
return; return;
if(signal == "trigger")
{
std::cerr << "The trigger signal should not be removed. Aborting." << std::endl;
return;
}
//lock the mutex to avoid deleting the signal during a call to trigger //lock the mutex to avoid deleting the signal during a call to trigger
while(! mutex_.try_lock() ){} while(! mutex_.try_lock() ){}
bindedSignal_.erase (signal);
signalDeregistration(signal); signalDeregistration(signal);
bindedSignal_.erase (signal);
mutex_.unlock(); mutex_.unlock();
} }
...@@ -226,7 +232,19 @@ namespace dynamicgraph ...@@ -226,7 +232,19 @@ namespace dynamicgraph
void RosPublish::clear () void RosPublish::clear ()
{ {
bindedSignal_.clear (); std::map<std::string, bindedSignal_t>::iterator it = bindedSignal_.begin();
for(; it!= bindedSignal_.end(); )
{
if (it->first != "trigger")
{
rm(it->first);
it = bindedSignal_.begin();
}
else
{
++it;
}
}
} }
int& RosPublish::trigger (int& dummy, int t) int& RosPublish::trigger (int& dummy, int t)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment