Node.cpp
Go to the documentation of this file.
1 
7 #include <csignal>
8 
9 #include "bota_node/Node.hpp"
10 
11 namespace bota_node
12 {
13 Node::Node(NodeHandlePtr nh) : nh_(std::move(nh)), workerManager_()
14 {
15 }
16 
18 {
19  // raise SIGINT, which will be caught by the owner of the node instance and initiates the shutdown
20  // todo: is there a better way?
21  raise(SIGINT);
22 }
23 
24 bool setProcessPriority(int priority)
25 {
26  sched_param params{};
27  params.sched_priority = priority;
28  if (sched_setscheduler(getpid(), SCHED_FIFO, &params) != 0)
29  {
30  ROS_WARN("Failed to set process priority to %d: %s. Check /etc/security/limits.conf for the rights.", priority,
31  std::strerror(errno));
32  return false;
33  }
34  return true;
35 }
36 
37 } // namespace bota_node
void shutdown()
Definition: Node.cpp:17
#define ROS_WARN(...)
std::shared_ptr< ros::NodeHandle > NodeHandlePtr
Definition: Node.hpp:24
bool setProcessPriority(int priority)
Definition: Node.cpp:24


bota_node
Author(s):
autogenerated on Wed Mar 3 2021 03:09:11