does ros::ok return false if ros::init_options::NoSigintHandler

asked 2018-09-28 12:54:57 -0600

debonair gravatar image

updated 2018-09-28 16:00:13 -0600

does ros::ok always returns false irrespective of if signal handler is installed or not.? If I use ros::init_options::NoSigintHandler and use boost::asio::io_service io_service, how do I make sure that my node is terminated without escalating to SIGTERM. It never reaches to handler.


 int main( int argc , char** argv )
{
  ros::init(argc, argv, "name", ros::init_options::NoSigintHandler);
  boost::asio::io_service io_service;

// Construct a signal set registered for process termination. boost::asio::signal_set signals(io_service, SIGINT ); signals.async_wait( &io_service { ROS_ERROR("inside signal handler"); io_service.stop(); });

boost::asio::spawn(io_service, { while(1); } );

io_service.run(); return 0; }

edit retag flag offensive close merge delete

Comments

1

Can we get a bit more context? Maybe a (minimal) code sample that we can reproduce this with?

allenh1 gravatar image allenh1  ( 2018-09-28 14:26:50 -0600 )edit

@allenh1 added.

debonair gravatar image debonair  ( 2018-09-28 15:26:11 -0600 )edit