https://github.com/intelligentsystemslabutv/ros2_signal_handler
Signal handler module for ROS 2 applications.
https://github.com/intelligentsystemslabutv/ros2_signal_handler
Last synced: 5 months ago
JSON representation
Signal handler module for ROS 2 applications.
- Host: GitHub
- URL: https://github.com/intelligentsystemslabutv/ros2_signal_handler
- Owner: IntelligentSystemsLabUTV
- License: gpl-3.0
- Created: 2022-03-02T11:29:41.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-03T16:34:32.000Z (almost 4 years ago)
- Last Synced: 2024-11-11T00:32:35.357Z (over 1 year ago)
- Language: C++
- Size: 21.5 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ros2_signal_handler
Signal handler module for ROS 2 applications.
Can be used by any ROS 2 standalone application (but also to component managers, if that's needed), and allows to define custom behaviours upon process termination.
**The main motivation behind this is that `rclcpp::init` installs its own signal handler, thus overriding any other termination procedure you might need.**
This also adds support for initialization of custom ROS 2 contexts, and uses `sigaction` to manage handlers.
## Usage
This package is made of a single header only: `signal_handler.hpp`, so to access its functions you just need to include that.
All operations are performed by a `ROS2SignalHandler::SignalHandler` object; to use it, interface it with the following public methods:
- `SignalHandler::init` to initialize it;
- `SignalHandler::install` to install a new signal handler for a given signal;
- `SignalHandler::uninstall` to uninstall a previously-installed signal handler;
- `SignalHandler::ignore` to ignore a specific signal;
- `SignalHandler::fini` to reset the `SignalHandler` object and restore everything to default settings and behaviours.
Routines may throw `std` exceptions upon error.
Refer to code comments for specific API documentation.