Skip to main content

ShutdownCallbackFn

Type Alias ShutdownCallbackFn 

Source
pub type ShutdownCallbackFn = unsafe extern "C" fn(*mut c_void);
Expand description

A shutdown hook: extern "C" so the same slot serves Rust, C and C++ without a second registry, and so no allocator is involved.

Deliberately NOT a closure. rclcpp takes std::function<void()>, which is a heap allocation per registration; the callback shape the rest of this tree’s FFI surface already uses is a bare function pointer plus an opaque context the callee casts back to its own state.