File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,16 @@ impl ClientHandle {
4141}
4242
4343impl 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 ( ) ;
You can’t perform that action at this time.
0 commit comments