Skip to content

Commit 262770f

Browse files
author
GueLaKais
committed
Added comments to clientHandle
Client handle has no comments yet.
1 parent 5f41764 commit 262770f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

rclrs/src/client.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ impl ClientHandle {
4141
}
4242

4343
impl Drop for ClientHandle {
44+
/// Cleans up the ROS client when the `ClientHandle` instance is dropped.
45+
///
46+
/// This implementation finalizes the `rcl_client_t` instance by calling `rcl_client_fini`.
47+
/// It also acquires the entity lifecycle mutex to protect against the risk of global variables
48+
/// in the rmw implementation being unsafely modified during cleanup.
49+
///
50+
/// # Safety
51+
///
52+
/// This function calls an unsafe function (`rcl_client_fini`) from the ROS client library.
53+
/// The entity lifecycle mutex is locked to ensure thread safety during the cleanup process.
4454
fn drop(&mut self) {
4555
let rcl_client = self.rcl_client.get_mut().unwrap();
4656
let mut rcl_node = self.node_handle.rcl_node.lock().unwrap();

0 commit comments

Comments
 (0)