ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

From the documentation:

void ros::requestShutdown ( )
Request that the node shut itself down from within a ROS thread. This method signals a ROS thread to call shutdown().

void ros::shutdown ( )
Disconnects everything and unregisters from the master. It is generally not necessary to call this function, as the node will automatically shutdown when all NodeHandles destruct. However, if you want to break out of a spin() loop explicitly, this function allows that. <br&lt;< p="">

From the definition:
the requestShutdown() just sets a global bool (g_shutdown_requested) to true, which is later processed in the checkForShutdown() method which runs from within a mutex inside a PollManager. The point is to prevent from deadlocking with another thread that's already in the middle of shutdown()

click to hide/show revision 2
No.2 Revision

From the documentation:
:

  • void ros::requestShutdown ( )


    Request that the node shut itself down from within a ROS thread. This method signals a ROS thread to call shutdown().


  • void ros::shutdown( )

    void ros::shutdown

    ( )

    Disconnects everything and unregisters from the master. It is generally not necessary to call this function, as the node will automatically shutdown when all NodeHandles destruct. However, if you want to break out of a spin() loop explicitly, this function allows that.

    <br&lt;< p="">

From the definition:

the requestShutdown() just sets a global bool (g_shutdown_requested) to true, which is later processed in the checkForShutdown() method which runs from within a mutex inside a PollManager. The point is to prevent from deadlocking with another thread that's already in the middle of shutdown()