RobotWebTools / rclnodejs

Node.js version of ROS 2.0 client
https://docs.ros.org/en/humble/Concepts/Basic/About-Client-Libraries.html?highlight=rclnodejs#community-maintained
Apache License 2.0
319 stars 70 forks source link

Use Read-write locks to protect the data shared between threads #649

Closed minggangw closed 4 years ago

minggangw commented 4 years ago

Currently, we are using uv_mutex_lock/uv_mutex_unlock to protect data shared between threads:

https://github.com/RobotWebTools/rclnodejs/blob/326ad707343133b9badaf927c2f8fb0dacc34886/src/handle_manager.hpp#L28-L35

But we could use Read-write locks to make it more efficient.