RobotWebTools / rclnodejs

Node.js version of ROS 2.0 client
https://docs.ros.org/en/jazzy/Concepts/Basic/About-Client-Libraries.html#community-maintained
Apache License 2.0
335 stars 72 forks source link

Block the background thread when no handles are added #763

Closed minggangw closed 3 years ago

minggangw commented 3 years ago

Currently, if parameter service is not enabled and no handles are added into the wait set, the background thread will loop without doing anything, which causes a high CPU load.

This patch implements that when there is no handles are attached to the current node, the background thread will be blocked by a semaphore and the main thread will signal it later when new handle has been created.

Fix #752

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.04%) to 91.787% when pulling dafe2a19a07bdeaceabca656e12b6f2711ba019d on minggangw:fix-issue-752 into 6f8a1a156780b131823e48650a35d9ff4760e462 on RobotWebTools:develop.